Class: Volt::BaseBinding
- Defined in:
- lib/volt/page/bindings/base_binding.rb
Direct Known Subclasses
AttributeBinding, ContentBinding, EachBinding, EventBinding, IfBinding, TemplateRenderer, ViewBinding, YieldBinding
Instance Attribute Summary collapse
-
#binding_name ⇒ Object
Returns the value of attribute binding_name.
-
#context ⇒ Object
Returns the value of attribute context.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #dom_section ⇒ Object
-
#initialize(page, target, context, binding_name) ⇒ BaseBinding
constructor
A new instance of BaseBinding.
- #remove ⇒ Object
- #remove_anchors ⇒ Object
Constructor Details
#initialize(page, target, context, binding_name) ⇒ BaseBinding
Returns a new instance of BaseBinding.
15 16 17 18 19 20 21 22 |
# File 'lib/volt/page/bindings/base_binding.rb', line 15 def initialize(page, target, context, binding_name) @page = page @target = target @context = context @binding_name = binding_name @@binding_number ||= 10_000 end |
Instance Attribute Details
#binding_name ⇒ Object
Returns the value of attribute binding_name.
13 14 15 |
# File 'lib/volt/page/bindings/base_binding.rb', line 13 def binding_name @binding_name end |
#context ⇒ Object
Returns the value of attribute context.
13 14 15 |
# File 'lib/volt/page/bindings/base_binding.rb', line 13 def context @context end |
#target ⇒ Object
Returns the value of attribute target.
13 14 15 |
# File 'lib/volt/page/bindings/base_binding.rb', line 13 def target @target end |
Instance Method Details
#dom_section ⇒ Object
24 25 26 |
# File 'lib/volt/page/bindings/base_binding.rb', line 24 def dom_section @dom_section ||= target.dom_section(@binding_name) end |
#remove ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/volt/page/bindings/base_binding.rb', line 28 def remove @dom_section.remove if @dom_section # Clear any references @target = nil @context = nil @dom_section = nil end |
#remove_anchors ⇒ Object
37 38 39 |
# File 'lib/volt/page/bindings/base_binding.rb', line 37 def remove_anchors @dom_section.remove_anchors if @dom_section end |