Class: Deployable::ErbTemplate
- Inherits:
-
Object
- Object
- Deployable::ErbTemplate
- Defined in:
- lib/deployable/helpers/erb_template.rb
Instance Method Summary collapse
-
#initialize(template) ⇒ ErbTemplate
constructor
A new instance of ErbTemplate.
- #render(variables) ⇒ Object
Constructor Details
#initialize(template) ⇒ ErbTemplate
Returns a new instance of ErbTemplate.
6 7 8 |
# File 'lib/deployable/helpers/erb_template.rb', line 6 def initialize(template) @template = ERB.new(template) end |
Instance Method Details
#render(variables) ⇒ Object
10 11 12 13 |
# File 'lib/deployable/helpers/erb_template.rb', line 10 def render(variables) context = OpenStruct.new(:config => variables).instance_eval{ binding } @template.result(context) end |