Class: Mago::Cli::Formatter
- Inherits:
-
Object
- Object
- Mago::Cli::Formatter
- Includes:
- Colorize
- Defined in:
- lib/mago/cli/formatter.rb
Overview
Formats report to be printed
Direct Known Subclasses
Instance Method Summary collapse
-
#format ⇒ String
Format report.
-
#initialize(report, opts = {}) ⇒ Formatter
constructor
A new instance of Formatter.
Methods included from Colorize
#colorize, #green, #pink, #red, #yellow
Constructor Details
#initialize(report, opts = {}) ⇒ Formatter
Returns a new instance of Formatter.
11 12 13 14 |
# File 'lib/mago/cli/formatter.rb', line 11 def initialize(report, opts = {}) @report = report @color = opts[:color] end |
Instance Method Details
#format ⇒ String
Format report.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mago/cli/formatter.rb', line 19 def format out = '' @report.files.each do |file| format_file(file, out) end @report.errors.each do |error| format_error(error, out) end out end |