Class: Html2rss::FeedResolution::Runner
- Inherits:
-
Object
- Object
- Html2rss::FeedResolution::Runner
- Defined in:
- lib/html2rss/feed_resolution.rb
Overview
Internal tournament runner (keeps Html2rss::FeedResolution a Zeitwerk namespace module).
Instance Method Summary collapse
-
#call ⇒ Result
rubocop:disable-next Metrics/AbcSize, Metrics/MethodLength -- policy → candidates → probe → select.
-
#initialize(entry_url:, response:, session:, config:, articles:, surface_category: nil) ⇒ Runner
constructor
rubocop:disable-next Metrics/ParameterLists -- tournament context stays co-located.
Constructor Details
#initialize(entry_url:, response:, session:, config:, articles:, surface_category: nil) ⇒ Runner
rubocop:disable-next Metrics/ParameterLists -- tournament context stays co-located
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/html2rss/feed_resolution.rb', line 192 def initialize(entry_url:, response:, session:, config:, articles:, surface_category: nil) raise ArgumentError, 'articles must be an Array' unless articles.is_a?(Array) @entry_url = Html2rss::Url.from_absolute(entry_url) @response = response @session = session @config = config @articles = articles @surface_category = surface_category end |
Instance Method Details
#call ⇒ Result
rubocop:disable-next Metrics/AbcSize, Metrics/MethodLength -- policy → candidates → probe → select
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/html2rss/feed_resolution.rb', line 206 def call return skip(:policy_skip) unless Policy.resolve?( config:, articles:, surface_category: ) candidates = CandidateGenerator.call( entry_url:, response:, max: max_probes ) return skip(:no_candidates) if candidates.empty? scored = probe_candidates(candidates) winner = Scorer.pick_winner(scored:, entry_articles_count: articles.size) return skip(:no_winner, probe_count: scored.size) unless winner apply(winner, probe_count: scored.size) end |