Class: EagerGroup::Preloader::AggregationFinder
- Inherits:
-
Object
- Object
- EagerGroup::Preloader::AggregationFinder
- Defined in:
- lib/eager_group/preloader/aggregation_finder.rb
Direct Known Subclasses
HasMany, HasManyThroughBelongsTo, HasManyThroughMany, ManyToMany
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#record_ids ⇒ Object
readonly
Returns the value of attribute record_ids.
-
#reflection ⇒ Object
readonly
Returns the value of attribute reflection.
Instance Method Summary collapse
- #definition_scope ⇒ Object
- #group_by_key ⇒ Object
-
#initialize(klass, definition, arguments, records) ⇒ AggregationFinder
constructor
A new instance of AggregationFinder.
Constructor Details
#initialize(klass, definition, arguments, records) ⇒ AggregationFinder
Returns a new instance of AggregationFinder.
8 9 10 11 12 13 14 |
# File 'lib/eager_group/preloader/aggregation_finder.rb', line 8 def initialize(klass, definition, arguments, records) @klass = klass @definition = definition @reflection = @klass.reflect_on_association(definition.association) @arguments = arguments @records = records end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
6 7 8 |
# File 'lib/eager_group/preloader/aggregation_finder.rb', line 6 def arguments @arguments end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
6 7 8 |
# File 'lib/eager_group/preloader/aggregation_finder.rb', line 6 def definition @definition end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
6 7 8 |
# File 'lib/eager_group/preloader/aggregation_finder.rb', line 6 def klass @klass end |
#record_ids ⇒ Object (readonly)
Returns the value of attribute record_ids.
6 7 8 |
# File 'lib/eager_group/preloader/aggregation_finder.rb', line 6 def record_ids @record_ids end |
#reflection ⇒ Object (readonly)
Returns the value of attribute reflection.
6 7 8 |
# File 'lib/eager_group/preloader/aggregation_finder.rb', line 6 def reflection @reflection end |
Instance Method Details
#definition_scope ⇒ Object
16 17 18 |
# File 'lib/eager_group/preloader/aggregation_finder.rb', line 16 def definition_scope reflection.klass.instance_exec(*arguments, &definition.scope) if definition.scope end |
#group_by_key ⇒ Object
24 25 26 |
# File 'lib/eager_group/preloader/aggregation_finder.rb', line 24 def group_by_key @klass.primary_key end |