我有一系列哈希,@ fathers。
a_father = { "father" => "Bob", "age" => 40 }
@fathers << a_father
a_father = { "father" => "David", "age" => 32 }
@fathers << a_father
a_father = { "father" => "Batman", "age" => 50 }
@fathers << a_father
我如何搜索该数组并返回一个哈希数组,对于该数组,块返回true?
例如:
@fathers.some_method("age" > 35) #=> array containing the hashes of bob and batman
谢谢。