Class: ConfigTemplates::Models::Template
- Inherits:
-
Object
- Object
- ConfigTemplates::Models::Template
- Defined in:
- lib/config_templates/models/template.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #content ⇒ Object
- #destination ⇒ Object
- #engine ⇒ Object
- #extension ⇒ Object
-
#initialize(path) ⇒ Template
constructor
A new instance of Template.
- #validator ⇒ Object
Constructor Details
#initialize(path) ⇒ Template
Returns a new instance of Template.
5 6 7 8 |
# File 'lib/config_templates/models/template.rb', line 5 def initialize(path) @path = path @config = ::ConfigTemplates.config end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/config_templates/models/template.rb', line 3 def path @path end |
Instance Method Details
#content ⇒ Object
10 11 12 |
# File 'lib/config_templates/models/template.rb', line 10 def content @content ||= ::File.read @path end |
#destination ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/config_templates/models/template.rb', line 18 def destination engine.output_file_name ::File.join( @config.destination_path, @config.stage.to_s, @path.sub(@config.templates_path, '') ) end |
#engine ⇒ Object
30 31 32 |
# File 'lib/config_templates/models/template.rb', line 30 def engine @config.engine extension end |
#extension ⇒ Object
14 15 16 |
# File 'lib/config_templates/models/template.rb', line 14 def extension ::File.extname @path end |
#validator ⇒ Object
26 27 28 |
# File 'lib/config_templates/models/template.rb', line 26 def validator @config.validator @path end |