Class: XCPerfect::Printer
- Inherits:
-
Object
- Object
- XCPerfect::Printer
- Defined in:
- lib/xcperfect/printer.rb
Overview
Printer handles the initialization of the output formatter and is directly called by the main ‘xcperfect` file during execution
Instance Attribute Summary collapse
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
Instance Method Summary collapse
-
#initialize(params, json) ⇒ Printer
constructor
A new instance of Printer.
- #pretty_print(targets) ⇒ Object
Constructor Details
#initialize(params, json) ⇒ Printer
Returns a new instance of Printer.
7 8 9 10 |
# File 'lib/xcperfect/printer.rb', line 7 def initialize(params, json) klass = params[:formatter] @formatter = klass.new(params[:ascii], params[:colorize], json) end |
Instance Attribute Details
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
5 6 7 |
# File 'lib/xcperfect/printer.rb', line 5 def formatter @formatter end |
Instance Method Details
#pretty_print(targets) ⇒ Object
12 13 14 15 16 |
# File 'lib/xcperfect/printer.rb', line 12 def pretty_print(targets) formatted_text = formatter.pretty_format(targets) STDOUT.print(formatted_text + "\n") STDOUT.flush end |