Class: Crawlscope::StructuredData::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/crawlscope/structured_data/reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(io:, report_path: nil) ⇒ Reporter

Returns a new instance of Reporter.



8
9
10
11
# File 'lib/crawlscope/structured_data/reporter.rb', line 8

def initialize(io:, report_path: nil)
  @io = io
  @report_path = report_path
end

Instance Method Details

#report(result) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/crawlscope/structured_data/reporter.rb', line 13

def report(result)
  report = Report.new(result)

  if report.all_valid?
    @io.puts("")
    @io.puts("All #{report.total} URLs passed validation.")
  else
    report_failures(report)
  end
end