Module: EasyType::Template
- Defined in:
- lib/easy_type/template.rb
Overview
Contains a template helper method.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (String) template(name, context)
This allows you to use an erb file.
Class Method Details
+ (Object) included(parent)
8 9 10 |
# File 'lib/easy_type/template.rb', line 8 def self.included(parent) parent.extend(Template) end |
Instance Method Details
- (String) template(name, context)
This allows you to use an erb file. Just like in the normal Puppet classes. The file is searched in the template directory on the same level as the ruby library path. For most puppet classes this is eqal to the normal template path of a module
26 27 28 29 30 |
# File 'lib/easy_type/template.rb', line 26 def template(name, context) full_name = get_erb_file(name) raise ArgumentError, "file #{name} not found" unless full_name ERB.new(IO.read(full_name)).result(context) end |