Class: HammerCLI::Output::Adapter::Yaml

Inherits:
TreeStructure show all
Defined in:
lib/hammer_cli/output/adapter/yaml.rb

Instance Method Summary collapse

Methods inherited from TreeStructure

#initialize, #prepare_collection, #prepare_message, #tags

Methods inherited from Abstract

#initialize, #paginate_by_default?, #print_error, #reset_context, #tags

Constructor Details

This class inherits a constructor from HammerCLI::Output::Adapter::TreeStructure

Instance Method Details



9
10
11
12
# File 'lib/hammer_cli/output/adapter/yaml.rb', line 9

def print_collection(fields, collection)
  result = prepare_collection(fields, collection)
  output_stream.puts YAML.dump(result)
end


14
15
16
17
# File 'lib/hammer_cli/output/adapter/yaml.rb', line 14

def print_message(msg, msg_params={})
  data = prepare_message(msg, msg_params)
  puts YAML.dump(data)
end


4
5
6
7
# File 'lib/hammer_cli/output/adapter/yaml.rb', line 4

def print_record(fields, record)
  result = prepare_collection(fields, [record].flatten(1))
  output_stream.puts YAML.dump(result.first)
end