goldiloader 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/goldiloader.rb +34 -0
- data/lib/goldiloader/active_record_patches.rb +2 -0
- data/lib/goldiloader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d30741df3c728239a50f4668f908f40cb0be785d5403848648faccc32b329d9d
|
4
|
+
data.tar.gz: 7032140f7401f0e47ac717b48d1089a6211d1ea7c78c3c64a1c0879882a47fbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9ae29eddaba860fa1a9075aae6788629f56e2d47bb71afef20dc39f587070c8572820694d1650a50d625d142739de419c7c9617a6cae6b6a4257fd753a3b2a8
|
7
|
+
data.tar.gz: cf79ee0b429d1716371ae655cae72dc811fec672d53c69409f24a46301326e90c5a2c02f60332b7ec3e4581c7a984e2cfbdb658fdbca11c8df340e53f9c217bc
|
data/lib/goldiloader.rb
CHANGED
@@ -8,3 +8,37 @@ require 'goldiloader/scope_info'
|
|
8
8
|
require 'goldiloader/association_options'
|
9
9
|
require 'goldiloader/association_loader'
|
10
10
|
require 'goldiloader/active_record_patches'
|
11
|
+
|
12
|
+
module Goldiloader
|
13
|
+
class << self
|
14
|
+
|
15
|
+
# Sets the process-wide enabled status
|
16
|
+
attr_accessor :globally_enabled
|
17
|
+
|
18
|
+
def enabled?
|
19
|
+
Thread.current.fetch(:goldiloader_enabled, globally_enabled)
|
20
|
+
end
|
21
|
+
|
22
|
+
def enabled=(val)
|
23
|
+
Thread.current[:goldiloader_enabled] = val
|
24
|
+
end
|
25
|
+
|
26
|
+
def enabled
|
27
|
+
old_enabled = enabled?
|
28
|
+
self.enabled = true
|
29
|
+
yield
|
30
|
+
ensure
|
31
|
+
self.enabled = old_enabled
|
32
|
+
end
|
33
|
+
|
34
|
+
def disabled
|
35
|
+
old_enabled = enabled?
|
36
|
+
self.enabled = false
|
37
|
+
yield
|
38
|
+
ensure
|
39
|
+
self.enabled = old_enabled
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
self.globally_enabled = true
|
44
|
+
end
|
data/lib/goldiloader/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goldiloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Turkel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|