class BadLinkFinder::PageChecker

Attributes

page_url[R]

Public Class Methods

new(host, page, result_cache, logger = BadLinkFinder::NullLogger.new) click to toggle source
# File lib/bad_link_finder/page_checker.rb, line 5
def initialize(host, page, result_cache, logger = BadLinkFinder::NullLogger.new)
  host = host.chomp('/') + '/'
  @page = page
  @page_url = URI.join(host, page.path).to_s
  @result_cache = result_cache
  @logger = logger
end

Public Instance Methods

Private Instance Methods

fetch_or_build(link) click to toggle source
# File lib/bad_link_finder/page_checker.rb, line 21
def fetch_or_build(link)
  @result_cache.fetch(link) || @result_cache.store(link, BadLinkFinder::Link.new(@page_url, link, @logger))
end