Class: ActiveResource::InheritingHash
- Inherits:
-
Hash
- Object
- Hash
- ActiveResource::InheritingHash
- Defined in:
- lib/active_resource/inheriting_hash.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(parent_hash = {}) ⇒ InheritingHash
constructor
A new instance of InheritingHash.
Constructor Details
#initialize(parent_hash = {}) ⇒ InheritingHash
Returns a new instance of InheritingHash.
5 6 7 8 9 |
# File 'lib/active_resource/inheriting_hash.rb', line 5 def initialize(parent_hash = {}) # Default hash value must be nil, which allows fallback lookup on parent hash super(nil) @parent_hash = parent_hash end |
Instance Method Details
#[](key) ⇒ Object
11 12 13 |
# File 'lib/active_resource/inheriting_hash.rb', line 11 def [](key) super || @parent_hash[key] end |