Class: CloudFormation::Template
- Defined in:
- lib/cloud_formation/template.rb
Constant Summary collapse
- AWS_TEMPLATE_FORMAT_VERSION =
"2010-09-09"
Instance Method Summary collapse
- #add_resource(resource) ⇒ Object
-
#initialize ⇒ Template
constructor
A new instance of Template.
- #render(pretty: false, indentation: 2) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ Template
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 |