Class: BaseBinding
Direct Known Subclasses
AttributeBinding, ContentBinding, EachBinding, EventBinding, IfBinding, TemplateBinding, TemplateRenderer
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
-
#initialize(target, context, binding_name) ⇒ BaseBinding
constructor
A new instance of BaseBinding.
- #queue_update ⇒ Object
- #remove ⇒ Object
- #remove_anchors ⇒ Object
- #section ⇒ Object
- #value_from_getter(getter) ⇒ Object
Constructor Details
#initialize(target, context, binding_name) ⇒ BaseBinding
Returns a new instance of BaseBinding.
4 5 6 7 8 9 10 |
# File 'lib/volt/templates/base_binding.rb', line 4 def initialize(target, context, binding_name) @target = target @context = context @binding_name = binding_name @@binding_number ||= 10000 end |
Instance Attribute Details
#binding_name ⇒ Object
Returns the value of attribute binding_name.
2 3 4 |
# File 'lib/volt/templates/base_binding.rb', line 2 def binding_name @binding_name end |
#context ⇒ Object
Returns the value of attribute context.
2 3 4 |
# File 'lib/volt/templates/base_binding.rb', line 2 def context @context end |
#target ⇒ Object
Returns the value of attribute target.
2 3 4 |
# File 'lib/volt/templates/base_binding.rb', line 2 def target @target end |
Instance Method Details
#queue_update ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/volt/templates/base_binding.rb', line 24 def queue_update if Volt.server? # Run right away update else end end |
#remove ⇒ Object
16 17 18 |
# File 'lib/volt/templates/base_binding.rb', line 16 def remove section.remove end |
#remove_anchors ⇒ Object
20 21 22 |
# File 'lib/volt/templates/base_binding.rb', line 20 def remove_anchors section.remove_anchors end |
#section ⇒ Object
12 13 14 |
# File 'lib/volt/templates/base_binding.rb', line 12 def section @section ||= target.section(@binding_name) end |
#value_from_getter(getter) ⇒ Object
33 34 35 36 |
# File 'lib/volt/templates/base_binding.rb', line 33 def value_from_getter(getter) # Evaluate the getter proc in the context return @context.instance_eval(&getter) end |