Class: Sablon::Environment
- Inherits:
-
Object
- Object
- Sablon::Environment
- 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
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#section_properties ⇒ Object
Returns the value of attribute section_properties.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#alter_context(context = {}) ⇒ Object
returns a new environment with merged contexts.
-
#document ⇒ Object
reader method for the DOM::Model instance stored on the template.
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/sablon/environment.rb', line 6 def context @context end |
#section_properties ⇒ Object
Returns the value of attribute section_properties.
7 8 9 |
# File 'lib/sablon/environment.rb', line 7 def section_properties @section_properties end |
#template ⇒ Object (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 |
#document ⇒ Object
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 |