Class: Volt::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, #remove_anchors

Constructor Details

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

Returns a new instance of TemplateRenderer.



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

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

  @sub_bindings = []

  bindings = 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.



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

def context
  @context
end

Instance Method Details

#removeObject



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

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

  super
end