Class: ConfigTemplates::Models::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/config_templates/models/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject (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

#contentObject



10
11
12
# File 'lib/config_templates/models/template.rb', line 10

def content
  @content ||= ::File.read @path
end

#destinationObject



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

#extensionObject



14
15
16
# File 'lib/config_templates/models/template.rb', line 14

def extension
  ::File.extname @path
end