Conditionally adding hash values in one array

Hi there,

Can anyone help me with this. I’m still new to ruby on rails and I’m
really stuck on it.

I have an array containing hashes.


a => [{:key1=>value, key2=>value,key3=>value},{:key1=>value,
key2=>value,key3=>value},{:key1=>value, key2=>value,key3=>value}]

Want I want to do is add the the value of key3 if their key1 and key2
are equal and save it to another array.

Is there a ruby-like way to do this?

Thanks for any help.