Class: Html2rss::FeedResolution::CandidateGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/feed_resolution/candidate_generator.rb

Overview

Builds same-origin entry-resolution candidates: one feed slot plus listing seeds.

Mix is 1 feed + up to listing_cap listing URLs (nav → segment first-wins → Syndication::CandidateCatalog::LISTING_PATHS). Feed never pads into listing slots.

Constant Summary collapse

DEFAULT_MAX =

Max candidates returned to the probe stage.

5
'header a[href], nav a[href], footer a[href]'
SEGMENT_STRATEGIES =

Segment strategies tried first-wins (≥2 same-origin primary links).

%i[list cluster semantic].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry_url:, response:, max: DEFAULT_MAX) ⇒ CandidateGenerator

Returns a new instance of CandidateGenerator.

Parameters:



31
32
33
34
35
# File 'lib/html2rss/feed_resolution/candidate_generator.rb', line 31

def initialize(entry_url:, response:, max: DEFAULT_MAX)
  @entry_url = Html2rss::Url.from_absolute(entry_url)
  @response = response
  @max = max
end

Class Method Details

.call(entry_url:, response:, max: DEFAULT_MAX) ⇒ Array<Html2rss::Url>

Parameters:

Returns:



23
24
25
# File 'lib/html2rss/feed_resolution/candidate_generator.rb', line 23

def self.call(entry_url:, response:, max: DEFAULT_MAX)
  new(entry_url:, response:, max:).call
end

Instance Method Details

#callArray<Html2rss::Url>

Returns:



39
40
41
# File 'lib/html2rss/feed_resolution/candidate_generator.rb', line 39

def call
  [feed_slot, *listing_urls.first(listing_cap)].compact.uniq
end