Class: Erber::Templater

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

Instance Method Summary collapse

Constructor Details

#initialize(template_text, mash_type = Hashie::Mash) ⇒ Templater

Returns a new instance of Templater.



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

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

Instance Method Details

#render(properties_hash) ⇒ Object



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

def render(properties_hash)
  mash = @mash_type.new(properties_hash)

  mash.extend BindingMixin

  @template.result(mash.get_binding)
end