Class: ThreadParent::Parents
- Inherits:
-
Object
- Object
- ThreadParent::Parents
- Defined in:
- lib/thread_parent.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(child) ⇒ Parents
constructor
A new instance of Parents.
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 |