class Gh::Trending::Parsers::HtmlChangedError

Class indicating that perhaps the HTML of the trending has changed for whatever reason.

Attributes

page_that_changed[R]

Public Class Methods

new(page_that_changed, msg = nil) click to toggle source
Calls superclass method
# File lib/gh_trending/parsers/html_changed_error.rb, line 11
def initialize(page_that_changed, msg = nil)
  @page_that_changed = page_that_changed
  page_changed_human_format = build_human_format_page_changed

  msg ||= 'The page can\'t be crawled anymore because' \
          "#{page_changed_human_format} changed its HTML format." \
          'Submit a PR to fix it!'
  super(msg)
end

Private Instance Methods

build_human_format_page_changed() click to toggle source
# File lib/gh_trending/parsers/html_changed_error.rb, line 23
def build_human_format_page_changed
  case page_that_changed
  when :front_page_with_repos
    'the front page that lists all trending repositories'
  when :front_page_with_devs
    'the front page that lists all trending developers'
  else
    error = "Unknown page_that_changed symbol: #{page_that_changed}"
    raise ArgumentError, error
  end
end