Class: Bosh::Template::Renderer
- Inherits:
-
Object
- Object
- Bosh::Template::Renderer
- Defined in:
- lib/bosh/template/renderer.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Renderer
constructor
A new instance of Renderer.
- #render(template_name) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Renderer
Returns a new instance of Renderer.
8 9 10 |
# File 'lib/bosh/template/renderer.rb', line 8 def initialize(={}) @context = .fetch(:context) end |
Instance Method Details
#render(template_name) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/bosh/template/renderer.rb', line 12 def render(template_name) spec = JSON.parse(@context) evaluation_context = EvaluationContext.new(spec, nil) template = ERB.new(File.read(template_name), trim_mode: "-") template.result(evaluation_context.get_binding) end |