Last active
May 17, 2019 21:02
-
-
Save rbrigby/826f7aa006cec9a92fe6f22169286be8 to your computer and use it in GitHub Desktop.
reduce an array of hashes with integer keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = [{1 => 'finish'}, {300 => 'color adder'}, {1000 => 'price group a'}] | |
x.map(&:keys).flatten.reduce(:+) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment