Class: Html2rss::AutoSource::Scraper::WordpressApi::PageScope::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/auto_source/scraper/wordpress_api/page_scope.rb

Overview

Resolves the page scope from page markup and canonical URL signals.

Instance Method Summary collapse

Constructor Details

#initialize(parsed_body:, url:) ⇒ Resolver

Returns a new instance of Resolver.

Parameters:

  • parsed_body (Nokogiri::HTML::Document)

    parsed HTML document

  • url (Html2rss::Url)

    canonical page URL



53
54
55
56
# File 'lib/html2rss/auto_source/scraper/wordpress_api/page_scope.rb', line 53

def initialize(parsed_body:, url:)
  @parsed_body = parsed_body
  @url = Html2rss::Url.from_absolute(url)
end

Instance Method Details

#callPageScope

Returns derived page scope.

Returns:



60
61
62
63
64
65
66
# File 'lib/html2rss/auto_source/scraper/wordpress_api/page_scope.rb', line 60

def call
  category_scope ||
    tag_scope ||
    author_scope ||
    date_scope ||
    fallback_scope
end