Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
Untitled
a guest
Dec 16th, 2018
103
0
Never
Add comment
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
text
0.20 KB
| None
|
0
0
raw
download
clone
embed
print
report
hashes = [
{:a => 5, :b => 2},
{:a => 5, :c => 3},
{:a => 5, :d => 4},
{:e => 5}
]
result = hashes.inject do |memo, hash|
memo.merge(hash) { |key, old, new| old + new }
end
p result
Add Comment
Please,
Sign In
to add comment
Public Pastes
Untitled
48 min ago | 8.54 KB
installer.lua
Lua | 1 hour ago | 5.47 KB
Untitled
1 hour ago | 16.11 KB
Untitled
2 hours ago | 5.90 KB
Untitled
3 hours ago | 17.39 KB
Untitled
5 hours ago | 13.05 KB
/egg/ AI Translation Guide
6 hours ago | 7.05 KB
Untitled
7 hours ago | 19.26 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!