Class/Module Index [+]

Quicksearch

Chef::Mixin::Template

Public Instance Methods

render_template(template, context) click to toggle source

Render a template with Erubis. Takes a template as a string, and a context hash.

# File lib/chef/mixin/template.rb, line 38
def render_template(template, context)
  begin
    eruby = Erubis::Eruby.new(template)
    output = eruby.evaluate(context)
  rescue Object => e
    raise TemplateError.new(e, template, context)
  end
  Tempfile.open("chef-rendered-template") do |tempfile|
    tempfile.print(output)
    tempfile.close
    yield tempfile
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.