Module Hashie::Extensions::DeepFind
In: lib/hashie/extensions/deep_find.rb

Methods

Public Instance methods

deep_detect(key)

Alias for deep_find

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

 options = {user: {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] = {location: {address: '123 Street'}}
 my_hash.deep_find(:address) # => '123 Street'

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

 options = {users: [{location: {address: '123 Street'}}, {location: {address: '234 Street'}}]}
 options.extend(Hashie::Extensions::DeepFind)
 options.deep_find_all(:address) # => ['123 Street', '234 Street']

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

 my_hash = MyHash.new
 my_hash[:users] = [{location: {address: '123 Street'}}, {location: {address: '234 Street'}}]
 my_hash.deep_find_all(:address) # => ['123 Street', '234 Street']
deep_select(key)

Alias for deep_find_all

[Validate]