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

#queue_update, #remove_anchors, #section, #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
18
19
20
# File 'lib/volt/page/template_renderer.rb', line 5

def initialize(page, target, context, binding_name, template_name)
  # puts "new template renderer: #{context.inspect} - #{binding_name.inspect}"
  super(page, target, context, binding_name)

  # puts "Template Name: #{template_name}"

  @sub_bindings = []

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



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/volt/page/template_renderer.rb', line 22

def remove
  # puts "Remove Template: #{self} - #{@sub_bindings.inspect}"

  # Remove all of the sub-bindings
  # @sub_bindings.each(&:remove)

  @sub_bindings.each do |binding|
    # puts "REMOVE: #{binding.inspect}"
    binding.remove
    # puts "REMOVED"
  end

  @sub_bindings = []

  super
end