class Immutabler::Template::BaseTemplate
Attributes
template_file[RW]
Public Instance Methods
handlebars()
click to toggle source
# File lib/immutabler/template/template.rb, line 18 def handlebars @handlebars ||= Handlebars::Context.new end
helper(name, &helper_body)
click to toggle source
# File lib/immutabler/template/template.rb, line 26 def helper(name, &helper_body) handlebars.register_helper(name) do |context, arg, block| helper_body.call(context, arg, block).unindent end end
raw_template()
click to toggle source
# File lib/immutabler/template/template.rb, line 14 def raw_template @raw_template ||= File.read(template_file) end
template()
click to toggle source
# File lib/immutabler/template/template.rb, line 22 def template @template ||= handlebars.compile(raw_template, {noEscape: true}) end