module HashWrangler
Public Instance Methods
find_in_hash(key, object=self, found=nil)
click to toggle source
credit to stackoverflow.com/questions/8301566/
# File lib/also_energy/hash_wrangler.rb, line 3 def find_in_hash(key, object=self, found=nil) if object.respond_to?(:key?) && object.key?(key) return object[key] elsif object.is_a? Enumerable object.find { |*a| found = find_in_hash(key, a.last) } return found end end