lib/knj/arrayext.rb in knjrbfw-0.0.55 vs lib/knj/arrayext.rb in knjrbfw-0.0.57

- old
+ new

@@ -332,6 +332,24 @@ return nil else return ret end end + + #Returns a given hash in an array by mathing the contents up against another hash. + def self.array_hash_find(args) + args[:arr].each do |h| + found = true + + args[:args].each do |key, val| + if h[key] != val + found = false + break + end + end + + return h if found + end + + return nil + end end \ No newline at end of file