Class: Volt::YieldBinding

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

Instance Attribute Summary

Attributes inherited from BaseBinding

#binding_name, #context, #target, #volt_app

Instance Method Summary collapse

Methods inherited from BaseBinding

#dom_section, #getter_fail, #page, #remove_anchors

Constructor Details

#initialize(volt_app, target, context, binding_name) ⇒ YieldBinding

Returns a new instance of YieldBinding.



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

def initialize(volt_app, target, context, binding_name)
  super(volt_app, target, context, binding_name)

  # Get the path to the template to yield
  full_path = @context.attrs.content_template_path

  # Grab the controller for the content
  controller = @context.attrs.content_controller

  @current_template = TemplateRenderer.new(volt_app, @target, controller, @binding_name, full_path)
end

Instance Method Details

#removeObject



20
21
22
23
24
25
26
27
28
# File 'lib/volt/page/bindings/yield_binding.rb', line 20

def remove
  if @current_template
    # Remove the template if one has been rendered, when the template binding is
    # removed.
    @current_template.remove
  end

  super
end