Created
October 14, 2014 02:39
-
-
Save xymbol/ca04783d159a1d289a44 to your computer and use it in GitHub Desktop.
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
array = [ | |
{ x: 1, y: 2 }, | |
{ x: 2, y: 2 }, | |
{ x: 3, y: 2 } | |
] | |
array.sort_by do |k, v| | |
[k, v] # => [{:x=>1, :y=>2}, nil], [{:x=>2, :y=>2}, nil], [{:x=>3, :y=>2}, nil] | |
0 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment