Module: Rubee::Support::Hash::InstanceMethods
- Defined in:
- lib/rubee/support/hash.rb
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rubee/support/hash.rb', line 13 def [](key) return wrap(super(key)) if key?(key) alt_key = case key when ::Symbol then key.to_s when ::String then key.to_sym else key end wrap(super(alt_key)) end |
#deep_dig(key) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rubee/support/hash.rb', line 26 def deep_dig(key) return self[key] if self[key] each do |_, v| if v.is_a?(Hash) return v.deep_dig(key) end end nil end |