Module: Mongoid::Association::Bindable
- Includes:
- Threaded::Lifecycle
- Included in:
- Embedded::EmbeddedIn::Binding, Embedded::EmbedsMany::Binding, Embedded::EmbedsOne::Binding, Referenced::BelongsTo::Binding, Referenced::HasAndBelongsToMany::Binding, Referenced::HasMany::Binding, Referenced::HasOne::Binding
- Defined in:
- lib/mongoid/association/bindable.rb
Overview
Superclass for all objects that bind associations together.
Instance Attribute Summary collapse
-
#_association ⇒ Object
readonly
Returns the value of attribute _association.
-
#_base ⇒ Object
readonly
Returns the value of attribute _base.
-
#_target ⇒ Object
readonly
Returns the value of attribute _target.
Instance Method Summary collapse
-
#binding ⇒ Object
Execute the provided block inside a binding.
-
#initialize(base, target, association) ⇒ Object
Create the new binding.
Instance Attribute Details
#_association ⇒ Object (readonly)
Returns the value of attribute _association.
11 12 13 |
# File 'lib/mongoid/association/bindable.rb', line 11 def _association @_association end |
#_base ⇒ Object (readonly)
Returns the value of attribute _base.
11 12 13 |
# File 'lib/mongoid/association/bindable.rb', line 11 def _base @_base end |
#_target ⇒ Object (readonly)
Returns the value of attribute _target.
11 12 13 |
# File 'lib/mongoid/association/bindable.rb', line 11 def _target @_target end |
Instance Method Details
#binding ⇒ Object
Execute the provided block inside a binding.
33 34 35 36 37 38 39 |
# File 'lib/mongoid/association/bindable.rb', line 33 def binding unless _binding? _binding do yield(self) if block_given? end end end |
#initialize(base, target, association) ⇒ Object
Create the new binding.
21 22 23 |
# File 'lib/mongoid/association/bindable.rb', line 21 def initialize(base, target, association) @_base, @_target, @_association = base, target, association end |