Class: Sablon::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/sablon/environment.rb

Overview

Combines the user supplied context and template into a single object to manage data during template processing.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



6
7
8
# File 'lib/sablon/environment.rb', line 6

def context
  @context
end

#section_propertiesObject

Returns the value of attribute section_properties.



7
8
9
# File 'lib/sablon/environment.rb', line 7

def section_properties
  @section_properties
end

#templateObject (readonly)

Returns the value of attribute template.



5
6
7
# File 'lib/sablon/environment.rb', line 5

def template
  @template
end

Instance Method Details

#alter_context(context = {}) ⇒ Object

returns a new environment with merged contexts



10
11
12
13
# File 'lib/sablon/environment.rb', line 10

def alter_context(context = {})
  new_context = @context.merge(context)
  Environment.new(template, new_context)
end

#documentObject

reader method for the DOM::Model instance stored on the template



16
17
18
# File 'lib/sablon/environment.rb', line 16

def document
  @template.document
end