module Hashie::Extensions::DeepLocate

def deep_locate(comparator)

# {:title=>"CSS for intermediates", :pages=>80}]
# => [{:title=>"Ruby for beginners", :pages=>120},
books.deep_locate -> (key, value, object) { key == :pages && value <= 120 }

# {:title=>"Ruby for the rest of us", :pages=>576}]
# => [{:title=>"Ruby for beginners", :pages=>120},
books.deep_locate -> (key, value, object) { key == :title && value.include?("Ruby") }

# http://ruby-journal.com/becareful-with-space-in-lambda-hash-rocket-syntax-between-ruby-1-dot-9-and-2-dot-0/
# for ruby 1.9 leave *no* space between the lambda rocket and the braces

books.extend(Hashie::Extensions::DeepLocate)

]
}
]
}
pages: 576
title: "Ruby for the rest of us",
{
books: [
title: "Collection of ruby books",
{
},
pages: 80
title: "CSS for intermediates",
{
},
pages: 120
title: "Ruby for beginners",
{
books = [
@example

callable returns true for at least one the its elements.
given comparator callable and returns each Enumerable, for which the
Performs a depth-first search on deeply nested data structures for a
def deep_locate(comparator)
  Hashie::Extensions::DeepLocate.deep_locate(comparator, self)
end