thread_attr_accessor 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thread_attr_accessor/version.rb +1 -1
- data/lib/thread_attr_accessor.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9799a38f085c32f2cda8a9f59dd80a38306aa949
|
4
|
+
data.tar.gz: 4e5e96c47926aee33179fa291c6fc6dbf97168e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c00ade061a7ff933fa3819aa2af0ab04deba068b168ce05501138391da2a350f058424a907fb07d624e179980e753943194f03d6d3d52ae49709f93742037597
|
7
|
+
data.tar.gz: 8cdacf0a89aa6dc976fffd4acebc39a87338d93a8d583a884ffb68717f34828c8bc53eab7c34018a565719618b9a56e24aae886a0743ca5e2f3348c4797d5852
|
data/lib/thread_attr_accessor.rb
CHANGED
@@ -27,7 +27,7 @@ module ThreadAttrAccessor
|
|
27
27
|
def self.search_in_ancestor_threads(key)
|
28
28
|
ancestor = Thread.current.parent_thread
|
29
29
|
|
30
|
-
until ancestor.nil? || (ancestor_value = ancestor
|
30
|
+
until ancestor.nil? || (ancestor_value = ancestor.thread_variable_get(key))
|
31
31
|
ancestor = ancestor.parent_thread
|
32
32
|
end
|
33
33
|
|
@@ -73,11 +73,12 @@ module ThreadAttrAccessor
|
|
73
73
|
|
74
74
|
if get_default
|
75
75
|
get_value = ->(thread_key) {
|
76
|
-
if Thread.current.
|
77
|
-
|
76
|
+
if value = Thread.current.thread_variable_get(thread_key)
|
77
|
+
value
|
78
78
|
else
|
79
79
|
default_value = get_default.call(thread_key)
|
80
80
|
Thread.current.thread_variable_set(thread_key, default_value)
|
81
|
+
default_value
|
81
82
|
end
|
82
83
|
}
|
83
84
|
else
|