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 Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ StackTemplate

Returns a new instance of StackTemplate.



9
10
11
# File 'lib/moonshot/stack_template.rb', line 9

def initialize(filename)
  @filename = filename
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



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

def filename
  @filename
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/moonshot/stack_template.rb', line 25

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

#parametersObject



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

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

#resource_namesObject



21
22
23
# File 'lib/moonshot/stack_template.rb', line 21

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