Class: Kokonfig::Template
- Inherits:
-
Object
- Object
- Kokonfig::Template
- Defined in:
- lib/kokonfig/template.rb
Class Method Summary collapse
Instance Method Summary collapse
- #apply(data) ⇒ Object
-
#initialize(templateString) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(templateString) ⇒ Template
Returns a new instance of Template.
6 7 8 |
# File 'lib/kokonfig/template.rb', line 6 def initialize(templateString) @template = templateString end |
Class Method Details
Instance Method Details
#apply(data) ⇒ Object
15 16 17 18 |
# File 'lib/kokonfig/template.rb', line 15 def apply(data) object = Kokonfig::Objectifier.objectify(data) ERB.new(@template, nil, '-').result(object.instance_eval { binding }) end |