Class: DeepHash
- Inherits:
-
Object
- Object
- DeepHash
- Defined in:
- lib/deep_hash.rb
Overview
Instance Method Summary collapse
- #dig(*keys) ⇒ Object
-
#initialize(hash) ⇒ DeepHash
constructor
A new instance of DeepHash.
Constructor Details
#initialize(hash) ⇒ DeepHash
Returns a new instance of DeepHash.
11 12 13 |
# File 'lib/deep_hash.rb', line 11 def initialize(hash) @hash = hash end |
Instance Method Details
#dig(*keys) ⇒ Object
15 16 17 18 19 |
# File 'lib/deep_hash.rb', line 15 def dig(*keys) keys.inject(@hash) do |location, key| location[key] unless location.nil? end end |