Class: Html2rss::AutoSource::LinkHeuristics::DestinationFacts

Inherits:
Data
  • Object
show all
Defined in:
lib/html2rss/auto_source/link_heuristics/destination_facts.rb

Overview

Normalized URL plus reusable route-classification facts for one link.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#content_pathObject (readonly)

Returns the value of attribute content_path

Returns:

  • (Object)

    the current value of content_path



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def content_path
  @content_path
end

#destinationObject (readonly)

Returns the value of attribute destination

Returns:

  • (Object)

    the current value of destination



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def destination
  @destination
end

#high_confidence_junk_pathObject (readonly)

Returns the value of attribute high_confidence_junk_path

Returns:

  • (Object)

    the current value of high_confidence_junk_path



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def high_confidence_junk_path
  @high_confidence_junk_path
end

#high_confidence_utility_destinationObject (readonly)

Returns the value of attribute high_confidence_utility_destination

Returns:

  • (Object)

    the current value of high_confidence_utility_destination



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def high_confidence_utility_destination
  @high_confidence_utility_destination
end

#segmentsObject (readonly)

Returns the value of attribute segments

Returns:

  • (Object)

    the current value of segments



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def segments
  @segments
end

#shallowObject (readonly)

Returns the value of attribute shallow

Returns:

  • (Object)

    the current value of shallow



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def shallow
  @shallow
end

#strong_post_suffixObject (readonly)

Returns the value of attribute strong_post_suffix

Returns:

  • (Object)

    the current value of strong_post_suffix



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def strong_post_suffix
  @strong_post_suffix
end

#taxonomy_pathObject (readonly)

Returns the value of attribute taxonomy_path

Returns:

  • (Object)

    the current value of taxonomy_path



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def taxonomy_path
  @taxonomy_path
end

#urlObject (readonly)

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def url
  @url
end

#utility_pathObject (readonly)

Returns the value of attribute utility_path

Returns:

  • (Object)

    the current value of utility_path



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def utility_path
  @utility_path
end

#vanity_pathObject (readonly)

Returns the value of attribute vanity_path

Returns:

  • (Object)

    the current value of vanity_path



7
8
9
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 7

def vanity_path
  @vanity_path
end

Class Method Details

.build(url) ⇒ DestinationFacts

Returns route facts for downstream link scoring.

Parameters:

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/html2rss/auto_source/link_heuristics/destination_facts.rb', line 22

def self.build(url) # rubocop:disable Metrics/MethodLength
  classifier = PathClassifier.new(url.path_segments)

  new(
    url:,
    destination: url.to_s,
    segments: classifier.segments,
    strong_post_suffix: classifier.strong_post_suffix?,
    content_path: classifier.content_path?,
    utility_path: classifier.utility_path?,
    taxonomy_path: classifier.taxonomy_path?,
    vanity_path: classifier.vanity_path?,
    shallow: classifier.shallow?,
    high_confidence_junk_path: classifier.junk_path?,
    high_confidence_utility_destination: classifier.utility_destination?
  )
end