Class: HTMLProofer::Reporter::Terminal
- Inherits:
-
HTMLProofer::Reporter
- Object
- HTMLProofer::Reporter
- HTMLProofer::Reporter::Terminal
- Defined in:
- lib/html_proofer/reporter/terminal.rb
Instance Attribute Summary
Attributes inherited from HTMLProofer::Reporter
Instance Method Summary collapse
Methods inherited from HTMLProofer::Reporter
Methods included from Utils
#blank?, #create_nokogiri, #pluralize
Constructor Details
This class inherits a constructor from HTMLProofer::Reporter
Instance Method Details
#report ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/html_proofer/reporter/terminal.rb', line 6 def report msg = failures.each_with_object([]) do |(check_name, failures), arr| str = ["For the #{check_name} check, the following failures were found:\n"] failures.each do |failure| path_str = blank?(failure.path) ? "" : "At #{failure.path}" line_str = failure.line.nil? ? "" : ":#{failure.line}" path_and_line = "#{path_str}#{line_str}" path_and_line = blank?(path_and_line) ? "" : "* #{path_and_line}:\n\n" status_str = failure.status.nil? ? "" : " (status code #{failure.status})" indent = blank?(path_and_line) ? "* " : " " str << <<~MSG #{path_and_line}#{indent}#{failure.description}#{status_str} MSG end arr << str.join("\n") end @logger.log(:error, msg.join("\n")) end |