Class: RightScaleCLI::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/rightscale_cli/output.rb

Overview

Represents an output factory

Class Method Summary collapse

Class Method Details

.render(content, root_element, options) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rightscale_cli/output.rb', line 20

def self.render(content, root_element, options)
  if options[:xml]
    require 'active_support/core_ext'
    puts content.to_xml(root: root_element)
  elsif options[:json]
    require 'json'
    puts JSON.pretty_generate(content)
  else
    require 'yaml'
    puts content.to_yaml
  end
end