Class: Bolt::Outputter

Inherits:
Object
  • Object
show all
Defined in:
lib/bolt/outputter.rb,
lib/bolt/outputter/json.rb,
lib/bolt/outputter/human.rb,
lib/bolt/outputter/logger.rb

Direct Known Subclasses

Human, JSON, Logger

Defined Under Namespace

Classes: Human, JSON, Logger

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(color, verbose, trace, stream = $stdout) ⇒ Outputter

Returns a new instance of Outputter.



16
17
18
19
20
21
# File 'lib/bolt/outputter.rb', line 16

def initialize(color, verbose, trace, stream = $stdout)
  @color = color
  @verbose = verbose
  @trace = trace
  @stream = stream
end

Class Method Details

.for_format(format, color, verbose, trace) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/bolt/outputter.rb', line 5

def self.for_format(format, color, verbose, trace)
  case format
  when 'human'
    Bolt::Outputter::Human.new(color, verbose, trace)
  when 'json'
    Bolt::Outputter::JSON.new(color, verbose, trace)
  when nil
    raise "Cannot use outputter before parsing."
  end
end