Class: BadLinkFinder::PageChecker
- Inherits:
-
Object
- Object
- BadLinkFinder::PageChecker
- Defined in:
- lib/bad_link_finder/page_checker.rb
Instance Attribute Summary collapse
-
#page_url ⇒ Object
readonly
Returns the value of attribute page_url.
Instance Method Summary collapse
- #bad_links ⇒ Object
-
#initialize(host, page, result_cache, logger = BadLinkFinder::NullLogger.new) ⇒ PageChecker
constructor
A new instance of PageChecker.
Constructor Details
#initialize(host, page, result_cache, logger = BadLinkFinder::NullLogger.new) ⇒ PageChecker
Returns a new instance of PageChecker.
5 6 7 8 9 10 11 |
# 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 |
Instance Attribute Details
#page_url ⇒ Object (readonly)
Returns the value of attribute page_url.
13 14 15 |
# File 'lib/bad_link_finder/page_checker.rb', line 13 def page_url @page_url end |
Instance Method Details
#bad_links ⇒ Object
15 16 17 |
# File 'lib/bad_link_finder/page_checker.rb', line 15 def bad_links @bad_links ||= @page.links.map { |link| fetch_or_build(link) }.reject(&:valid?) end |