Class: Uniword::Validation::Report::TerminalFormatter
- Inherits:
-
Object
- Object
- Uniword::Validation::Report::TerminalFormatter
- Defined in:
- lib/uniword/validation/report/terminal_formatter.rb
Overview
Formats a VerificationReport as rich terminal output using Rainbow.
Constant Summary collapse
- LAYER_WIDTH =
48
Instance Method Summary collapse
-
#format(report, verbose: false) ⇒ String
Format a report for terminal display.
Instance Method Details
#format(report, verbose: false) ⇒ String
Format a report for terminal display.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/uniword/validation/report/terminal_formatter.rb', line 18 def format(report, verbose: false) lines = [] lines << "" lines << Rainbow(" \xF0\x9F\x94\x8D Verifying: #{report.file_path}").bright lines << "" report.layers.each do |layer| lines << format_layer(layer) if verbose || layer.fail? layer.issues.each { |issue| lines << format_issue(issue) } elsif layer.warnings.any? layer.warnings.each { |issue| lines << format_issue(issue) } end end lines << "" lines << Rainbow("\xE2\x94\x80" * 52).color("#555555") lines << format_summary(report) lines << "" lines.join("\n") end |