class Aws::Cfn::Yats::Yaml2Json

Attributes

yaml[RW]

Public Instance Methods

pprint_cfn_resource(name, options) click to toggle source
# File lib/aws/cfn/yats/yaml2json.rb, line 27
def pprint_cfn_resource(name, options)
  pprint_value({ name => options })
end
pprint_cfn_section(section, name, options) click to toggle source
# File lib/aws/cfn/yats/yaml2json.rb, line 23
def pprint_cfn_section(section, name, options)
  pprint_value(section)
end
pprint_cfn_template(tpl) click to toggle source
# File lib/aws/cfn/yats/yaml2json.rb, line 19
def pprint_cfn_template(tpl)
  pprint_value(tpl)
end
pprint_value(val, indent="\t") click to toggle source
# File lib/aws/cfn/yats/yaml2json.rb, line 31
def pprint_value(val, indent="\t")
  @json = JSON.pretty_generate(val, {
      :indent         => indent,
      :space          => ' ',
      :object_nl      => "\n",
      :array_nl       => "\n"
  } )

  puts @json
end
transform(template) click to toggle source
# File lib/aws/cfn/yats/yaml2json.rb, line 12
def transform(template)
  @template = template
  @yaml     = YAML.load(template)
  @simple   = simplify(@yaml)
  pprint(@simple)
end