Module: N1Loader::Goldiloader::LoaderPatch
- Included in:
- Loader
- Defined in:
- lib/n1_loader/goldiloader/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/goldiloader/loader_patch.rb', line 7 def context_setup @context_setup end |
Instance Method Details
#loaded? ⇒ Boolean
9 10 11 12 13 14 15 16 17 |
# File 'lib/n1_loader/goldiloader/loader_patch.rb', line 9 def loaded? return true if @already_loaded && @already_context super synchronize { non_thread_safe_context_setting unless @already_context } true end |
#non_thread_safe_context_setting ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/n1_loader/goldiloader/loader_patch.rb', line 19 def non_thread_safe_context_setting return if @already_context context_setup&.call(loaded_by_identity.values.flatten) @already_context = true end |