Class: CloudFormation

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

Constant Summary collapse

ELEMENTS =
[
  :parameters,
  :resources,
  :conditions,
  :outputs,
  :mappings,
  :description,
  :aws_template_format_version
]

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ CloudFormation

Returns a new instance of CloudFormation.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cloudformation.rb', line 16

def initialize(json)
  ELEMENTS.each do |e|
    key  = e.to_s.camel_case
    if key =~ /^Aws/
      key = key.sub(/^Aws/, "AWS")
    end

    if json[key]
      attr = parse_element(e, json[key])
      instance_variable_set("@" + e.to_s, attr)
    end
  end
end