Class: Html2rss::AutoSource::Scraper::LinkHeuristics::PostSuffixClassifier
- Inherits:
-
Object
- Object
- Html2rss::AutoSource::Scraper::LinkHeuristics::PostSuffixClassifier
- Defined in:
- lib/html2rss/auto_source/scraper/link_heuristics.rb
Overview
Classifies whether the final segment is a strong post-like suffix.
Instance Method Summary collapse
-
#initialize(segments) ⇒ PostSuffixClassifier
constructor
A new instance of PostSuffixClassifier.
-
#strong? ⇒ Boolean
True when the final path segment looks like a post slug.
Constructor Details
#initialize(segments) ⇒ PostSuffixClassifier
Returns a new instance of PostSuffixClassifier.
375 376 377 |
# File 'lib/html2rss/auto_source/scraper/link_heuristics.rb', line 375 def initialize(segments) @segments = segments end |
Instance Method Details
#strong? ⇒ Boolean
Returns true when the final path segment looks like a post slug.
380 381 382 383 384 |
# File 'lib/html2rss/auto_source/scraper/link_heuristics.rb', line 380 def strong? @segments.any? && included_last_segment? && LeadingSegments.new(@segments).trusted_post_context? end |