Class: Charmkit::Plugins::Core::InstanceMethods::TemplateRenderer
- Inherits:
-
Object
- Object
- Charmkit::Plugins::Core::InstanceMethods::TemplateRenderer
- Defined in:
- lib/charmkit/plugins/core.rb
Overview
Processes templates
template ‘my-template.erb’ ‘/etc/config/me.conf’, service_name: “nginx”
Class Method Summary collapse
Class Method Details
.empty_binding ⇒ Object
46 47 48 |
# File 'lib/charmkit/plugins/core.rb', line 46 def self.empty_binding binding end |
.render(template_content, locals = {}) ⇒ Object
50 51 52 53 54 |
# File 'lib/charmkit/plugins/core.rb', line 50 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 |