Method: Hashie::Extensions::DeepFind#deep_find

Defined in:
lib/hashie/extensions/deep_find.rb

#deep_find(key) ⇒ Object Also known as: deep_detect

Performs a depth-first search on deeply nested data structures for a key and returns the first occurrence of the key.

options = {location: {address: '123 Street'}} options.extend(Hashie::Extensions::DeepFind) options.deep_find(:address) # => '123 Street'

class MyHash < Hash include Hashie::Extensions::DeepFind end

my_hash = MyHash.new my_hash[:user] = {address: '123 Street'} my_hash.deep_find(:address) # => '123 Street'



18
19
20
# File 'lib/hashie/extensions/deep_find.rb', line 18

def deep_find(key)
  _deep_find(key)
end