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 Metrics/AbcSize, Metrics/MethodLength -- policy → candidates → probe → select.
-
#initialize(entry_url:, response:, session:, config:, articles:, surface_category: nil) ⇒ Runner
constructor
rubocop:disable Metrics/ParameterLists -- tournament context stays co-located.
Constructor Details
#initialize(entry_url:, response:, session:, config:, articles:, surface_category: nil) ⇒ Runner
rubocop:disable Metrics/ParameterLists -- tournament context stays co-located
196 197 198 199 200 201 202 203 204 205 |
# File 'lib/html2rss/feed_resolution.rb', line 196 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 Metrics/AbcSize, Metrics/MethodLength -- policy → candidates → probe → select
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/html2rss/feed_resolution.rb', line 211 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 |