最佳答案
我有一个哈希数组@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
我如何搜索这个数组,并返回一个哈希数组,其中一个块返回真?
例如:
@fathers.some_method("age" > 35) #=> array containing the hashes of bob and batman
谢谢。