Class: StackMaster::SparkleFormation::TemplateContext
- Inherits:
-
AttributeStruct
- Object
- AttributeStruct
- StackMaster::SparkleFormation::TemplateContext
- Includes:
- SparkleFormation::SparkleAttribute, SparkleFormation::SparkleAttribute::Aws, SparkleFormation::Utils::TypeCheckers
- Defined in:
- lib/stack_master/sparkle_formation/template_file.rb
Class Method Summary collapse
Instance Method Summary collapse
- #has_var?(var_key) ⇒ Boolean
-
#initialize(vars, prefix) ⇒ TemplateContext
constructor
A new instance of TemplateContext.
- #render(file_name, vars = {}) ⇒ Object
Constructor Details
#initialize(vars, prefix) ⇒ TemplateContext
Returns a new instance of TemplateContext.
24 25 26 27 28 |
# File 'lib/stack_master/sparkle_formation/template_file.rb', line 24 def initialize(vars, prefix) self._camel_keys = true @vars = vars @prefix = prefix end |
Class Method Details
.build(vars, prefix) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/stack_master/sparkle_formation/template_file.rb', line 13 def self.build(vars, prefix) ::Class.new(self).tap do |klass| vars.each do |key, value| klass.send(:define_method, key) do value end end end.new(vars, prefix) end |
Instance Method Details
#has_var?(var_key) ⇒ Boolean
30 31 32 |
# File 'lib/stack_master/sparkle_formation/template_file.rb', line 30 def has_var?(var_key) @vars.include?(var_key) end |