Class: Reviewer::Report::Formatter
- Inherits:
-
Object
- Object
- Reviewer::Report::Formatter
- Includes:
- Output::Formatting
- Defined in:
- lib/reviewer/report/formatter.rb
Overview
Formats a Report for summary output to the console
Constant Summary
Constants included from Output::Formatting
Output::Formatting::CHECKMARK, Output::Formatting::XMARK
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
Instance Method Summary collapse
-
#initialize(report, output: Output.new) ⇒ Formatter
constructor
Creates a formatter for displaying a report.
-
#print ⇒ void
Prints the formatted report to the console.
Constructor Details
#initialize(report, output: Output.new) ⇒ Formatter
Creates a formatter for displaying a report
16 17 18 19 20 |
# File 'lib/reviewer/report/formatter.rb', line 16 def initialize(report, output: Output.new) @report = report @output = output @name_width = 0 end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
9 10 11 |
# File 'lib/reviewer/report/formatter.rb', line 9 def output @output end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
9 10 11 |
# File 'lib/reviewer/report/formatter.rb', line 9 def report @report end |
Instance Method Details
#print ⇒ void
This method returns an undefined value.
Prints the formatted report to the console
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/reviewer/report/formatter.rb', line 25 def print if report.results.empty? output.printer.puts(:muted, 'No tools to run') return end print_tool_lines output.newline print_summary end |