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