Class: Erber::Templater
- Inherits:
-
Object
- Object
- Erber::Templater
- Defined in:
- lib/erber/templater.rb
Instance Method Summary collapse
-
#initialize(template_text, mash_type = Hashie::Mash) ⇒ Templater
constructor
A new instance of Templater.
- #render(properties_hash) ⇒ Object
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 |