Class: Codgen::HandleBarsTemplateProvider

Inherits:
TemplateProvider show all
Defined in:
lib/codgen/template_provider.rb

Instance Method Summary collapse

Instance Method Details

#extensionObject



47
48
49
# File 'lib/codgen/template_provider.rb', line 47

def extension
  '.handlebars'
end

#nameObject



43
44
45
# File 'lib/codgen/template_provider.rb', line 43

def name
  'handlebars'
end

#render(template, data) ⇒ Object



37
38
39
40
41
# File 'lib/codgen/template_provider.rb', line 37

def render(template, data)
  handlebars = Handlebars::Context.new
  template = handlebars.compile(template)
  template.call(data)
end