Class: Html2rss::AutoSource::Discovery::SemanticAnchorCandidates::DestinationWinners

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb

Overview

Keeps the strongest semantic anchor fact for each destination.

Instance Method Summary collapse

Constructor Details

#initializeDestinationWinners

Returns a new instance of DestinationWinners.



169
170
171
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 169

def initialize
  @winners = {}
end

Instance Method Details

#add(facts) ⇒ void

This method returns an undefined value.

Parameters:



180
181
182
183
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 180

def add(facts)
  destination = facts.destination
  @winners[destination] = stronger_fact(@winners[destination], facts)
end

#to_aArray<AnchorFacts>

Returns strongest candidate per destination.

Returns:

  • (Array<AnchorFacts>)

    strongest candidate per destination



174
175
176
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 174

def to_a
  @winners.values
end