Sha256: f3069a20bbe54d7d5855aca1897f5af120406903fbede9972fb555967eed82e1
Contents?: true
Size: 799 Bytes
Versions: 1
Compression:
Stored size: 799 Bytes
Contents
# frozen_string_literal: true module TerraformTemplateRenderer # Provides a Binding context which we can add arbitrary params to (which will become instance # variables for the templates when they get rendered). Also provides a method to render # partial templates which will pass through itself as the binding context for the partial # template class Binding def initialize(template_path) @template_path = template_path end def add_param(key, value) instance_variable_set("@#{key}", value) end def bind binding end def render(partial_path) path_to_partial = File.join(@template_path, partial_path) renderer = Renderer.new(File.read(path_to_partial), @template_path) renderer.render_with_binding(self) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
terraform-template-renderer-0.3.0 | lib/terraform_template_renderer/binding.rb |