Class: XCPerfect::Printer

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#formatterObject (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