Class: TemplateRenderer

Inherits:
BaseBinding show all
Defined in:
lib/volt/page/template_renderer.rb

Instance Attribute Summary collapse

Attributes inherited from BaseBinding

#binding_name, #target

Instance Method Summary collapse

Methods inherited from BaseBinding

#dom_section, #queue_update, #remove_anchors, #value_from_getter

Constructor Details

#initialize(page, target, context, binding_name, template_name) ⇒ TemplateRenderer

Returns a new instance of TemplateRenderer.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/volt/page/template_renderer.rb', line 5

def initialize(page, target, context, binding_name, template_name)
  super(page, target, context, binding_name)

  @sub_bindings = []

  bindings = self.dom_section.set_content_to_template(page, template_name)

  bindings.each_pair do |id,bindings_for_id|
    bindings_for_id.each do |binding|
      @sub_bindings << binding.call(page, target, context, id)
    end
  end
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



4
5
6
# File 'lib/volt/page/template_renderer.rb', line 4

def context
  @context
end

Instance Method Details

#removeObject



19
20
21
22
23
24
# File 'lib/volt/page/template_renderer.rb', line 19

def remove
  @sub_bindings.each(&:remove)
  @sub_bindings = []

  super
end