class Sablon::Environment
Combines the user supplied context and template into a single object to manage data during template processing.
Attributes
context[R]
section_properties[R]
template[R]
Public Class Methods
new(template, context = {})
click to toggle source
# File lib/sablon/environment.rb, line 26 def initialize(template, context = {}) @template = template @context = Context.transform_hash(context) end
Public Instance Methods
alter_context(context = {})
click to toggle source
returns a new environment with merged contexts
# File lib/sablon/environment.rb, line 10 def alter_context(context = {}) new_context = @context.merge(context) Environment.new(template, new_context) end
document()
click to toggle source
reader method for the DOM::Model
instance stored on the template
# File lib/sablon/environment.rb, line 16 def document @template.document end
section_properties=(properties)
click to toggle source
# File lib/sablon/environment.rb, line 20 def section_properties=(properties) @section_properties = Context.transform_hash(properties) end