Class: ActiveAny::Associations::Preloader::AlreadyLoaded
- Inherits:
-
Object
- Object
- ActiveAny::Associations::Preloader::AlreadyLoaded
- Defined in:
- lib/active_any/associations/preloader.rb
Instance Attribute Summary collapse
-
#owners ⇒ Object
readonly
Returns the value of attribute owners.
-
#reflection ⇒ Object
readonly
Returns the value of attribute reflection.
Instance Method Summary collapse
-
#initialize(_klass, owners, reflection, _preload_scope) ⇒ AlreadyLoaded
constructor
A new instance of AlreadyLoaded.
- #preloaded_records ⇒ Object
- #run(preloader) ⇒ Object
Constructor Details
#initialize(_klass, owners, reflection, _preload_scope) ⇒ AlreadyLoaded
Returns a new instance of AlreadyLoaded.
62 63 64 65 |
# File 'lib/active_any/associations/preloader.rb', line 62 def initialize(_klass, owners, reflection, _preload_scope) @owners = owners @reflection = reflection end |
Instance Attribute Details
#owners ⇒ Object (readonly)
Returns the value of attribute owners.
60 61 62 |
# File 'lib/active_any/associations/preloader.rb', line 60 def owners @owners end |
#reflection ⇒ Object (readonly)
Returns the value of attribute reflection.
60 61 62 |
# File 'lib/active_any/associations/preloader.rb', line 60 def reflection @reflection end |
Instance Method Details
#preloaded_records ⇒ Object
69 70 71 |
# File 'lib/active_any/associations/preloader.rb', line 69 def preloaded_records owners.flat_map { |owner| owner.association(reflection.name).target } end |
#run(preloader) ⇒ Object
67 |
# File 'lib/active_any/associations/preloader.rb', line 67 def run(preloader); end |