Class: HammerCLI::Output::Adapter::Yaml
- Inherits:
-
TreeStructure
- Object
- Abstract
- TreeStructure
- HammerCLI::Output::Adapter::Yaml
- Defined in:
- lib/hammer_cli/output/adapter/yaml.rb
Instance Method Summary collapse
- #print_collection(fields, collection) ⇒ Object
- #print_message(msg, msg_params = {}) ⇒ Object
- #print_record(fields, record) ⇒ Object
Methods inherited from TreeStructure
#initialize, #prepare_collection, #prepare_message, #tags
Methods inherited from Abstract
#initialize, #paginate_by_default?, #print_error, #tags
Constructor Details
This class inherits a constructor from HammerCLI::Output::Adapter::TreeStructure
Instance Method Details
#print_collection(fields, collection) ⇒ Object
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 |
#print_message(msg, msg_params = {}) ⇒ Object
14 15 16 17 |
# File 'lib/hammer_cli/output/adapter/yaml.rb', line 14 def (msg, msg_params={}) data = (msg, msg_params) puts YAML.dump(data) end |
#print_record(fields, record) ⇒ Object
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 |