Module: N1Loader::ArLazyPreload::LoaderCollectionPatch

Included in:
LoaderCollection
Defined in:
lib/n1_loader/ar_lazy_preload/loader_collection_patch.rb

Overview

A patch to LoaderCollection to setup lazy context lazily.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#context_setupObject

Returns the value of attribute context_setup.



7
8
9
# File 'lib/n1_loader/ar_lazy_preload/loader_collection_patch.rb', line 7

def context_setup
  @context_setup
end

Instance Method Details

#with(**args) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/n1_loader/ar_lazy_preload/loader_collection_patch.rb', line 9

def with(**args)
  result = super

  result.context_setup = context_setup if context_setup && result.context_setup.nil?

  result
end