thread-parent 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/thread_parent/version.rb +1 -1
- data/lib/thread_parent.rb +3 -7
- data/test/test_thread_parent.rb +1 -0
- metadata +3 -3
data/lib/thread_parent.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'thread_parent/version'
|
2
2
|
require 'thread'
|
3
|
-
|
3
|
+
require 'pry'
|
4
4
|
module ThreadParent
|
5
5
|
|
6
6
|
class Parents
|
@@ -12,7 +12,7 @@ module ThreadParent
|
|
12
12
|
def [](key)
|
13
13
|
if @child.key?(key)
|
14
14
|
@child[key]
|
15
|
-
|
15
|
+
elsif @child.parent
|
16
16
|
@child.parent.parents[key]
|
17
17
|
end
|
18
18
|
end
|
@@ -29,17 +29,13 @@ class Thread
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def parent
|
32
|
-
@_parent
|
32
|
+
@_parent #|| Thread.main
|
33
33
|
end
|
34
34
|
|
35
35
|
def parents
|
36
36
|
ThreadParent::Parents.new(self)
|
37
37
|
end
|
38
38
|
|
39
|
-
def self.parent
|
40
|
-
Thread.current.parent
|
41
|
-
end
|
42
|
-
|
43
39
|
def self.parents
|
44
40
|
ThreadParent::Parents.new(Thread.current)
|
45
41
|
end
|
data/test/test_thread_parent.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thread-parent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-05-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70233354825040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70233354825040
|
25
25
|
description: ThreadParent facilitates spawning threads that maintain a reference to
|
26
26
|
the thread that created them. The primary goal is to allow thread local variable
|
27
27
|
lookup through the ancestor chain.
|