Class: SourceMonitor::Queries::ScrapeCandidatesQuery
- Inherits:
-
Object
- Object
- SourceMonitor::Queries::ScrapeCandidatesQuery
- Defined in:
- lib/source_monitor/queries/scrape_candidates_query.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(threshold: SourceMonitor.config.scraping.scrape_recommendation_threshold) ⇒ ScrapeCandidatesQuery
constructor
A new instance of ScrapeCandidatesQuery.
Constructor Details
#initialize(threshold: SourceMonitor.config.scraping.scrape_recommendation_threshold) ⇒ ScrapeCandidatesQuery
Returns a new instance of ScrapeCandidatesQuery.
6 7 8 |
# File 'lib/source_monitor/queries/scrape_candidates_query.rb', line 6 def initialize(threshold: SourceMonitor.config.scraping.scrape_recommendation_threshold) @threshold = threshold.to_i end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/source_monitor/queries/scrape_candidates_query.rb', line 10 def call return SourceMonitor::Source.none if @threshold <= 0 SourceMonitor::Source.active .where(scraping_enabled: false) .where(id: source_ids_below_threshold) end |