Module: Goldiloader

Defined in:
lib/goldiloader.rb,
lib/goldiloader/version.rb,
lib/goldiloader/scope_info.rb,
lib/goldiloader/compatibility.rb,
lib/goldiloader/custom_preloads.rb,
lib/goldiloader/association_loader.rb,
lib/goldiloader/association_options.rb,
lib/goldiloader/auto_include_context.rb,
lib/goldiloader/active_record_patches.rb

Defined Under Namespace

Modules: AssociationLoader, AssociationOptions, AssociationPatch, AssociationReflectionPatch, BasePatch, CollectionAssociationPatch, CollectionProxyPatch, Compatibility, CustomPreloads, MergerPatch, RelationPatch, SingularAssociationPatch, ThroughAssociationPatch Classes: AutoIncludeContext, ScopeInfo

Constant Summary collapse

VERSION =
'5.3.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.globally_enabledObject

Sets the process-wide enabled status



21
22
23
# File 'lib/goldiloader.rb', line 21

def globally_enabled
  @globally_enabled
end

Class Method Details

.disabledObject



39
40
41
42
43
44
45
# File 'lib/goldiloader.rb', line 39

def disabled
  old_enabled = Thread.current[:goldiloader_enabled]
  self.enabled = false
  yield
ensure
  self.enabled = old_enabled
end

.enabledObject



31
32
33
34
35
36
37
# File 'lib/goldiloader.rb', line 31

def enabled
  old_enabled = Thread.current[:goldiloader_enabled]
  self.enabled = true
  yield
ensure
  self.enabled = old_enabled
end

.enabled=(val) ⇒ Object



27
28
29
# File 'lib/goldiloader.rb', line 27

def enabled=(val)
  Thread.current[:goldiloader_enabled] = val
end

.enabled?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/goldiloader.rb', line 23

def enabled?
  Thread.current.fetch(:goldiloader_enabled, globally_enabled)
end