Sha256: dd62af8721a296587b50a9926e24d249ff44cf174d4cdda3c891b4e46bfbf3f6
Contents?: true
Size: 583 Bytes
Versions: 75
Compression:
Stored size: 583 Bytes
Contents
require 'thread' module ThreadParent class Parents def initialize(child) @child = child end def [](key) if @child.key?(key) @child[key] elsif @child.parent @child.parent.parents[key] end end end end class Thread alias_method :_initialize, :initialize def initialize(*args, &block) @_parent = Thread.current _initialize(*args, &block) end def parent @_parent end def parents ThreadParent::Parents.new(self) end def self.parents ThreadParent::Parents.new(Thread.current) end end
Version data entries
75 entries across 75 versions & 1 rubygems