Class: Erber::Templater

Inherits:
Object
  • Object
show all
Defined in:
lib/erber/templater.rb

Instance Method Summary collapse

Constructor Details

#initialize(template_text) ⇒ Templater

Returns a new instance of Templater.



12
13
14
# File 'lib/erber/templater.rb', line 12

def initialize(template_text)
  @template = ERB.new(template_text, 0, "% <> > -")
end

Instance Method Details

#render(properties_hash) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/erber/templater.rb', line 16

def render(properties_hash)
  mash = Hashie::Mash.new(properties_hash)

  mash.extend BindingMixin

  @template.result(mash.get_binding)
end