Class: Stackr::Template
- Inherits:
-
Object
- Object
- Stackr::Template
- Defined in:
- lib/stackr/template.rb
Instance Attribute Summary collapse
-
#capabilities ⇒ Object
Returns the value of attribute capabilities.
-
#includes_path ⇒ Object
Returns the value of attribute includes_path.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parameter_map ⇒ Object
Returns the value of attribute parameter_map.
-
#template_dsl ⇒ Object
Returns the value of attribute template_dsl.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.load(template_file) ⇒ Object
eval the contents in the context of this class.
Instance Method Summary collapse
- #body ⇒ Object
- #generate ⇒ Object
-
#initialize ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize ⇒ Template
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
#capabilities ⇒ Object
Returns the value of attribute capabilities.
8 9 10 |
# File 'lib/stackr/template.rb', line 8 def capabilities @capabilities end |
#includes_path ⇒ Object
Returns the value of attribute includes_path.
9 10 11 |
# File 'lib/stackr/template.rb', line 9 def includes_path @includes_path end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/stackr/template.rb', line 8 def name @name end |
#parameter_map ⇒ Object
Returns the value of attribute parameter_map.
8 9 10 |
# File 'lib/stackr/template.rb', line 8 def parameter_map @parameter_map end |
#template_dsl ⇒ Object
Returns the value of attribute template_dsl.
8 9 10 |
# File 'lib/stackr/template.rb', line 8 def template_dsl @template_dsl end |
#url ⇒ Object
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
#body ⇒ Object
27 28 29 30 31 32 |
# File 'lib/stackr/template.rb', line 27 def body if @body.nil? @body = generate() end @body end |
#generate ⇒ Object
23 24 25 |
# File 'lib/stackr/template.rb', line 23 def generate JSON.pretty_generate(template_dsl) end |