Class: Html2rss::AutoSource::Discovery::SemanticAnchorCandidates::DestinationWinners
- Inherits:
-
Object
- Object
- Html2rss::AutoSource::Discovery::SemanticAnchorCandidates::DestinationWinners
- 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
- #add(facts) ⇒ void
-
#initialize ⇒ DestinationWinners
constructor
A new instance of DestinationWinners.
-
#to_a ⇒ Array<AnchorFacts>
Strongest candidate per destination.
Constructor Details
#initialize ⇒ DestinationWinners
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.
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_a ⇒ Array<AnchorFacts>
Returns 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 |