lib/thread_parent.rb in thread-parent-1.0.2 vs lib/thread_parent.rb in thread-parent-1.0.3
- old
+ new
@@ -1,8 +1,8 @@
require 'thread_parent/version'
require 'thread'
-
+require 'pry'
module ThreadParent
class Parents
def initialize(child)
@@ -10,11 +10,11 @@
end
def [](key)
if @child.key?(key)
@child[key]
- else
+ elsif @child.parent
@child.parent.parents[key]
end
end
end
end
@@ -27,18 +27,14 @@
@_parent = Thread.current
_initialize(*args, &block)
end
def parent
- @_parent
+ @_parent #|| Thread.main
end
def parents
ThreadParent::Parents.new(self)
- end
-
- def self.parent
- Thread.current.parent
end
def self.parents
ThreadParent::Parents.new(Thread.current)
end