Class: Crawlscope::Reporter
- Inherits:
-
Object
- Object
- Crawlscope::Reporter
- Defined in:
- lib/crawlscope/reporter.rb
Instance Method Summary collapse
-
#initialize(io:) ⇒ Reporter
constructor
A new instance of Reporter.
- #report(result) ⇒ Object
Constructor Details
#initialize(io:) ⇒ Reporter
Returns a new instance of Reporter.
5 6 7 |
# File 'lib/crawlscope/reporter.rb', line 5 def initialize(io:) @io = io end |
Instance Method Details
#report(result) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/crawlscope/reporter.rb', line 9 def report(result) @io.puts("Crawlscope validation") @io.puts("Base URL: #{result.base_url}") @io.puts("Sitemap: #{result.sitemap_path}") @io.puts("URLs: #{result.urls.size}") @io.puts("Pages: #{result.pages.size}") if result.ok? @io.puts("Status: OK") return end @io.puts("Status: FAILED") @io.puts("Issues: #{result.issues.size}") result.issues.by_severity.sort_by { |severity, _issues| severity.to_s }.each do |severity, issues| @io.puts("#{severity}: #{issues.size}") end result.issues.each do |issue| @io.puts("- [#{issue.severity}] #{issue.url} #{issue.}") end end |