Guest User

Untitled

a guest
Dec 16th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. hashes = [
  2. {:a => 5, :b => 2},
  3. {:a => 5, :c => 3},
  4. {:a => 5, :d => 4},
  5. {:e => 5}
  6. ]
  7.  
  8. result = hashes.inject do |memo, hash|
  9. memo.merge(hash) { |key, old, new| old + new }
  10. end
  11.  
  12. p result
Add Comment
Please, Sign In to add comment