Class: ThreadParent::Parents

Inherits:
Object
  • Object
show all
Defined in:
lib/thread_parent.rb

Instance Method Summary collapse

Constructor Details

#initialize(child) ⇒ Parents

Returns a new instance of Parents.



8
9
10
# File 'lib/thread_parent.rb', line 8

def initialize(child)
  @child = child
end

Instance Method Details

#[](key) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/thread_parent.rb', line 12

def [](key)
  if @child.key?(key)
    @child[key]
  elsif @child.parent
    @child.parent.parents[key]
  end
end