Class: Charmkit::DSL::TemplateRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/charmkit/template.rb

Class Method Summary collapse

Class Method Details

.empty_bindingObject



6
7
8
# File 'lib/charmkit/template.rb', line 6

def self.empty_binding
  binding
end

.render(template_content, locals = {}) ⇒ Object



10
11
12
13
14
# File 'lib/charmkit/template.rb', line 10

def self.render(template_content, locals = {})
  b = empty_binding
  locals.each { |k, v| b.local_variable_set(k, v) }
  ERB.new(template_content).result(b)
end