我有这样的事情:
array = [
hash1 = {"marco"=>"polo", "girth"=>"skinny", "onion"=>true},
hash2 = {"darco"=>"johnson", "girth"=>"wide", "onion"=>false},
hash3 = {"flarco"=>"kiwi", "birth"=>"noble", "onion"=>false}
]
Run Code Online (Sandbox Code Playgroud)
其中一个且只有一个onion是true在任何给定的时间.
我想一个表达式或函数返回值(即名hash1,hash2持有其哈希)onion是目前true.我怎样才能做到这一点?