Class: Puppet::ModuleTool::Applications::Generator::ParsedFileNode
- Inherits:
-
Node
- Object
- Node
- Puppet::ModuleTool::Applications::Generator::ParsedFileNode
show all
- Defined in:
- lib/vendor/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
115
116
117
|
# File 'lib/vendor/puppet/module_tool/applications/generator.rb', line 115
def self.matches?(path)
path.file? && path.extname == '.erb'
end
|
Instance Method Details
122
123
124
125
|
# File 'lib/vendor/puppet/module_tool/applications/generator.rb', line 122
def contents
template = ERB.new(read)
template.result(@generator.send(:get_binding))
end
|
126
127
128
|
# File 'lib/vendor/puppet/module_tool/applications/generator.rb', line 126
def install!
target.open('w') { |f| f.write contents }
end
|
118
119
120
121
|
# File 'lib/vendor/puppet/module_tool/applications/generator.rb', line 118
def target
path = super
path.parent + path.basename('.erb')
end
|