Module: N1Loader::ArLazyPreload::LoaderPatch
- Included in:
- Loader
- Defined in:
- lib/n1_loader/ar_lazy_preload/loader_patch.rb
Overview
A patch to Loader to setup lazy context lazily.
Instance Attribute Summary collapse
-
#context_setup ⇒ Object
Returns the value of attribute context_setup.
Instance Method Summary collapse
Instance Attribute Details
#context_setup ⇒ Object
Returns the value of attribute context_setup.
7 8 9 |
# File 'lib/n1_loader/ar_lazy_preload/loader_patch.rb', line 7 def context_setup @context_setup end |
Instance Method Details
#loaded ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/n1_loader/ar_lazy_preload/loader_patch.rb', line 9 def loaded return @loaded if @loaded super context_setup&.call(preloaded_records) @loaded end |