Last active
December 28, 2017 20:27
-
-
Save ysinc88/0d6951ee3f4f6aa004dd1c0467b8e626 to your computer and use it in GitHub Desktop.
Hashes of numbers, used to populate collections
This file contains hidden or 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
range_array = *(1..20) | |
@nums = range_array.map{|n| Hash[n, n] }.reduce({}, :merge) | |
#=> {1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6, 7=>7, 8=>8, 9=>9, 10=>10, 11=>11, 12=>12, 13=>13, 14=>14, 15=>15, 16=>16, 17=>17, 18=>18, 19=>19, 20=>20} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment