Class: BrokenLinkFinder::Reporter
- Inherits:
-
Object
- Object
- BrokenLinkFinder::Reporter
- Defined in:
- lib/broken_link_finder/reporter/reporter.rb
Overview
Generic reporter class to be inherited from by format specific reporters.
Direct Known Subclasses
Constant Summary collapse
- NUM_VALUES =
The amount of pages/links to display when verbose is false.
3
Instance Method Summary collapse
-
#call(broken_verbose: true, ignored_verbose: false) ⇒ Object
(also: #report)
Pretty print a report detailing the full link summary.
-
#initialize(stream, sort, broken_links, ignored_links, broken_link_map, crawl_stats) ⇒ Reporter
constructor
Returns a new Reporter instance.
Constructor Details
#initialize(stream, sort, broken_links, ignored_links, broken_link_map, crawl_stats) ⇒ Reporter
Returns a new Reporter instance. stream is any Object that responds to :puts and :print.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/broken_link_finder/reporter/reporter.rb', line 11 def initialize(stream, sort, broken_links, ignored_links, broken_link_map, crawl_stats) unless stream.respond_to?(:puts) && stream.respond_to?(:print) raise 'stream must respond_to? :puts and :print' end raise "sort by either :page or :link, not #{sort}" \ unless %i[page link].include?(sort) @stream = stream @sort = sort @broken_links = broken_links @ignored_links = ignored_links @broken_link_map = broken_link_map @crawl_stats = crawl_stats end |
Instance Method Details
#call(broken_verbose: true, ignored_verbose: false) ⇒ Object Also known as: report
Pretty print a report detailing the full link summary.
29 30 31 |
# File 'lib/broken_link_finder/reporter/reporter.rb', line 29 def call(broken_verbose: true, ignored_verbose: false) raise 'Not implemented by parent class' end |