Class: Puppet::Module::Tool::Applications::Generator::ParsedFileNode
- Inherits:
-
Node
- Object
- Node
- Puppet::Module::Tool::Applications::Generator::ParsedFileNode
show all
- Defined in:
- lib/puppet/module/tool/applications/generator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Node
inherited, #initialize, on, #read, types
Class Method Details
.matches?(path) ⇒ Boolean
89
90
91
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 89
def self.matches?(path)
path.file? && path.extname == '.erb'
end
|
Instance Method Details
#contents ⇒ Object
96
97
98
99
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 96
def contents
template = ERB.new(read)
template.result(@generator.send(:binding))
end
|
#install! ⇒ Object
100
101
102
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 100
def install!
target.open('w') { |f| f.write contents }
end
|
#target ⇒ Object
92
93
94
95
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 92
def target
path = super
path.parent + path.basename('.erb')
end
|