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
- #extension ⇒ Object
-
#initialize(path, config) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(path, config) ⇒ Template
Returns a new instance of Template.
5 6 7 8 |
# File 'lib/config_templates/models/template.rb', line 5 def initialize(path, config) @path = path @config = 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 |
# File 'lib/config_templates/models/template.rb', line 18 def destination ::File.join @config.destination_path, @config.stage.to_s, @path.sub(@config.templates_path, '') end |
#extension ⇒ Object
14 15 16 |
# File 'lib/config_templates/models/template.rb', line 14 def extension ::File.extname @path end |