Class: Bolt::Outputter
- Inherits:
-
Object
- Object
- Bolt::Outputter
- Defined in:
- lib/bolt/outputter.rb,
lib/bolt/outputter/json.rb,
lib/bolt/outputter/human.rb
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(color, trace, stream = $stdout) ⇒ Outputter
constructor
A new instance of Outputter.
- #print_message(message) ⇒ Object
-
#replace_data_type(params) ⇒ Object
This method replaces data types tha have the name ‘Data’ with the string ‘Any’ This was a problem when using ‘bolt task show <task_name>’.
Constructor Details
#initialize(color, trace, stream = $stdout) ⇒ Outputter
Returns a new instance of Outputter.
16 17 18 19 20 |
# File 'lib/bolt/outputter.rb', line 16 def initialize(color, trace, stream = $stdout) @color = color @trace = trace @stream = stream end |
Class Method Details
.for_format(format, color, 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, trace) case format when 'human' Bolt::Outputter::Human.new(color, trace) when 'json' Bolt::Outputter::JSON.new(color, trace) when nil raise "Cannot use outputter before parsing." end end |
Instance Method Details
#print_message(message) ⇒ Object
187 188 189 |
# File 'lib/bolt/outputter/human.rb', line 187 def () @stream.puts() end |
#replace_data_type(params) ⇒ Object
This method replaces data types tha have the name ‘Data’ with the string ‘Any’ This was a problem when using ‘bolt task show <task_name>’
25 26 27 28 29 |
# File 'lib/bolt/outputter.rb', line 25 def replace_data_type(params) params.map do |_, v| v['type'] = 'Any' if v['type'].to_s == 'Data' end end |