Class: Mongoid::Association::EagerLoad::AssociationInclusion Private
- Defined in:
- lib/mongoid/association/eager_load/inclusion.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
An inclusion that stands for a single association. The LookupPipeline holds the stage-building helpers the kinds lean on, and a node carries its own children, so the pipeline is built by recursion from the roots downward.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#association ⇒ Mongoid::Association::Relatable
readonly
private
The association this stands for.
Class Method Summary collapse
-
.for(association, pipeline, children) ⇒ AssociationInclusion
private
Builds the right kind of inclusion for the association.
-
.for?(association) ⇒ true | false
private
Whether this kind handles the given association.
Instance Method Summary collapse
-
#initialize(association, pipeline, children) ⇒ AssociationInclusion
constructor
private
A new instance of AssociationInclusion.
Methods inherited from Inclusion
Constructor Details
#initialize(association, pipeline, children) ⇒ AssociationInclusion
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AssociationInclusion.
57 58 59 60 61 62 |
# File 'lib/mongoid/association/eager_load/inclusion.rb', line 57 def initialize(association, pipeline, children) super() @association = association @pipeline = pipeline @children = children end |
Instance Attribute Details
#association ⇒ Mongoid::Association::Relatable (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The association this stands for.
55 56 57 |
# File 'lib/mongoid/association/eager_load/inclusion.rb', line 55 def association @association end |
Class Method Details
.for(association, pipeline, children) ⇒ AssociationInclusion
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Builds the right kind of inclusion for the association. Each subclass decides whether it handles it (.for?); exactly one does.
40 41 42 |
# File 'lib/mongoid/association/eager_load/inclusion.rb', line 40 def for(association, pipeline, children) subclasses.find { |kind| kind.for?(association) }.new(association, pipeline, children) end |
.for?(association) ⇒ true | false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether this kind handles the given association.
49 50 51 |
# File 'lib/mongoid/association/eager_load/inclusion.rb', line 49 def for?(association) raise NotImplementedError end |