Class: Html2rss::Scoring::RankedSegment
- Inherits:
-
Data
- Object
- Data
- Html2rss::Scoring::RankedSegment
- Defined in:
- lib/html2rss/scoring/ranked_segment.rb
Overview
A segment paired with its composite score.
Instance Attribute Summary collapse
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#segment ⇒ Object
readonly
Returns the value of attribute segment.
Class Method Summary collapse
Instance Method Summary collapse
- #final_score ⇒ Float
- #junk_score ⇒ Float
- #position ⇒ Integer
- #primary_link ⇒ SST::Node?
- #quality_score ⇒ Float
- #root_node ⇒ SST::Node
Instance Attribute Details
#score ⇒ Object (readonly)
Returns the value of attribute score
7 8 9 |
# File 'lib/html2rss/scoring/ranked_segment.rb', line 7 def score @score end |
#segment ⇒ Object (readonly)
Returns the value of attribute segment
7 8 9 |
# File 'lib/html2rss/scoring/ranked_segment.rb', line 7 def segment @segment end |
Class Method Details
.build(segment:, score:) ⇒ RankedSegment
13 14 15 16 17 18 |
# File 'lib/html2rss/scoring/ranked_segment.rb', line 13 def self.build(segment:, score:) raise ArgumentError, 'segment must be AutoSource::Segment' unless segment.is_a?(Html2rss::AutoSource::Segment) raise ArgumentError, 'score must be Scoring::Score' unless score.is_a?(Score) new(segment:, score:) end |
Instance Method Details
#final_score ⇒ Float
30 |
# File 'lib/html2rss/scoring/ranked_segment.rb', line 30 def final_score = score.composite |
#junk_score ⇒ Float
38 |
# File 'lib/html2rss/scoring/ranked_segment.rb', line 38 def junk_score = score.junk |
#position ⇒ Integer
42 |
# File 'lib/html2rss/scoring/ranked_segment.rb', line 42 def position = segment.position |
#primary_link ⇒ SST::Node?
26 |
# File 'lib/html2rss/scoring/ranked_segment.rb', line 26 def primary_link = segment.primary_link |
#quality_score ⇒ Float
34 |
# File 'lib/html2rss/scoring/ranked_segment.rb', line 34 def quality_score = score.quality |
#root_node ⇒ SST::Node
22 |
# File 'lib/html2rss/scoring/ranked_segment.rb', line 22 def root_node = segment.root_node |