class Bosh::Template::Renderer

Public Class Methods

new(options={}) click to toggle source
# File lib/bosh/template/renderer.rb, line 8
def initialize(options={})
  @context = options.fetch(:context)
end

Public Instance Methods

render(template_name) click to toggle source
# 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), safe_level = nil, trim_mode = "-")
  template.result(evaluation_context.get_binding)
end