Module: OutputConverters
- Included in:
- SubCommandBase
- Defined in:
- lib/emasser/output_converters.rb
Instance Method Summary collapse
Instance Method Details
#to_output_hash(obj) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/emasser/output_converters.rb', line 4 def to_output_hash(obj) if obj.to_s.include? 'Error message' obj else hash = obj.instance_variables.each_with_object({}) do |var, h| h[var.to_s.delete('@')] = obj.instance_variable_get(var) end JSON.pretty_generate(hash) end end |