Class: Stackr::Template

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTemplate

Returns a new instance of Template.



11
12
13
14
15
# File 'lib/stackr/template.rb', line 11

def initialize
  @capabilities = []
  @parameter_map = {}
  @includes_path = 'includes'
end

Instance Attribute Details

#capabilitiesObject

Returns the value of attribute capabilities.



8
9
10
# File 'lib/stackr/template.rb', line 8

def capabilities
  @capabilities
end

#includes_pathObject

Returns the value of attribute includes_path.



9
10
11
# File 'lib/stackr/template.rb', line 9

def includes_path
  @includes_path
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/stackr/template.rb', line 8

def name
  @name
end

#parameter_mapObject

Returns the value of attribute parameter_map.



8
9
10
# File 'lib/stackr/template.rb', line 8

def parameter_map
  @parameter_map
end

#template_dslObject

Returns the value of attribute template_dsl.



8
9
10
# File 'lib/stackr/template.rb', line 8

def template_dsl
  @template_dsl
end

#urlObject

Returns the value of attribute url.



9
10
11
# File 'lib/stackr/template.rb', line 9

def url
  @url
end

Class Method Details

.load(template_file) ⇒ Object

eval the contents in the context of this class



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

def self.load(template_file)
  return nil if !File.exist?(template_file)
  eval File.read(template_file)
end

Instance Method Details

#bodyObject



27
28
29
30
31
32
# File 'lib/stackr/template.rb', line 27

def body
  if @body.nil?
    @body = generate()
  end
  @body
end

#generateObject



23
24
25
# File 'lib/stackr/template.rb', line 23

def generate
  JSON.pretty_generate(template_dsl)
end