Class: Deployable::ErbTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/deployable/helpers/erb_template.rb

Instance Method Summary collapse

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