Class: Generamba::ModuleTemplate
- Inherits:
-
Object
- Object
- Generamba::ModuleTemplate
- Defined in:
- lib/generamba/code_generation/module_template.rb
Overview
Represents a single Generamba module template
Instance Attribute Summary collapse
-
#code_files ⇒ Object
readonly
Returns the value of attribute code_files.
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#template_name ⇒ Object
readonly
Returns the value of attribute template_name.
-
#template_path ⇒ Object
readonly
Returns the value of attribute template_path.
-
#test_files ⇒ Object
readonly
Returns the value of attribute test_files.
Instance Method Summary collapse
-
#initialize(name, options = nil) ⇒ ModuleTemplate
constructor
A new instance of ModuleTemplate.
Constructor Details
#initialize(name, options = nil) ⇒ ModuleTemplate
Returns a new instance of ModuleTemplate.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generamba/code_generation/module_template.rb', line 9 def initialize(name, = nil) spec_path = TemplateHelper.obtain_spec(name) unless spec = YAML.load_file(spec_path) else spec_source = IO.read(spec_path) spec_template = Liquid::Template.parse(spec_source) spec_content = spec_template.render() spec = YAML.load(spec_content) end @code_files = spec[TEMPLATE_CODE_FILES_KEY] @test_files = spec[TEMPLATE_TEST_FILES_KEY] @template_name = spec[TEMPLATE_NAME_KEY] @template_path = TemplateHelper.obtain_path(name) @dependencies = spec[TEMPLATE_DEPENDENCIES_KEY] end |
Instance Attribute Details
#code_files ⇒ Object (readonly)
Returns the value of attribute code_files.
7 8 9 |
# File 'lib/generamba/code_generation/module_template.rb', line 7 def code_files @code_files end |
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
7 8 9 |
# File 'lib/generamba/code_generation/module_template.rb', line 7 def dependencies @dependencies end |
#template_name ⇒ Object (readonly)
Returns the value of attribute template_name.
7 8 9 |
# File 'lib/generamba/code_generation/module_template.rb', line 7 def template_name @template_name end |
#template_path ⇒ Object (readonly)
Returns the value of attribute template_path.
7 8 9 |
# File 'lib/generamba/code_generation/module_template.rb', line 7 def template_path @template_path end |
#test_files ⇒ Object (readonly)
Returns the value of attribute test_files.
7 8 9 |
# File 'lib/generamba/code_generation/module_template.rb', line 7 def test_files @test_files end |