Class: Moonshot::StackTemplate

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

Overview

A StackTemplate loads the template from disk and stores information about it.

Direct Known Subclasses

JsonStackTemplate, YamlStackTemplate

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ StackTemplate

Returns a new instance of StackTemplate.



7
8
9
# File 'lib/moonshot/stack_template.rb', line 7

def initialize(filename)
  @filename = filename
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/moonshot/stack_template.rb', line 23

def exist?
  File.exist?(@filename)
end

#parametersObject



11
12
13
14
15
16
17
# File 'lib/moonshot/stack_template.rb', line 11

def parameters
  template_body.fetch('Parameters', {}).map do |k, v|
    StackParameter.new(k,
                       default: v['Default'],
                       description: v.fetch('Description', ''))
  end
end

#resource_namesObject



19
20
21
# File 'lib/moonshot/stack_template.rb', line 19

def resource_names
  template_body.fetch('Resources', {}).keys
end