16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/rager/template/providers/mustache.rb', line 16
def template(input, options)
begin
require "mustache"
rescue LoadError
raise Rager::Errors::DependencyError.new("mustache", details: "Please install the mustache gem to use mustache templates")
end
::Mustache.render(input.template, input.variables)
rescue ::Mustache::Parser::SyntaxError, ::Mustache::ContextMiss => e
raise Rager::Errors::TemplateError.new(input.template, input.variables, details: e.message)
end
|