Created
November 10, 2012 20:46
-
-
Save greggroth/4052431 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
pry(main)> show-doc Array#sort! | |
From: array.c (C Method): | |
Number of lines: 9 | |
Owner: Array | |
Visibility: public | |
Signature: sort!() | |
Sorts self. Comparisons for | |
the sort will be done using the <=> operator or using | |
an optional code block. The block implements a comparison between | |
a and b, returning -1, 0, or +1. See also | |
Enumerable#sort_by. | |
a = [ "d", "a", "e", "c", "b" ] | |
a.sort #=> ["a", "b", "c", "d", "e"] | |
a.sort {|x,y| y <=> x } #=> ["e", "d", "c", "b", "a"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment