Class: CloudFormation::Template

Inherits:
Base
  • Object
show all
Defined in:
lib/cloud_formation/template.rb

Constant Summary collapse

AWS_TEMPLATE_FORMAT_VERSION =
"2010-09-09"

Instance Method Summary collapse

Methods inherited from Base

attribute_list, #build

Constructor Details

#initializeTemplate

Returns a new instance of Template.



10
11
12
# File 'lib/cloud_formation/template.rb', line 10

def initialize
  @resources = {}
end

Instance Method Details

#add_resource(resource) ⇒ Object



14
15
16
# File 'lib/cloud_formation/template.rb', line 14

def add_resource resource
  @resources[resource.name] = resource.serialize.tap { |a| a.delete("Name") }
end

#render(pretty: false, indentation: 2) ⇒ Object



18
19
20
# File 'lib/cloud_formation/template.rb', line 18

def render pretty: false, indentation: 2
  pretty ? JSON.pretty_generate(serialize, indent: " "*indentation) : serialize.to_json
end