summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorMartin Dürst <duerst@it.aoyama.ac.jp>2019-06-13 15:30:03 +0900
committerMartin Dürst <duerst@it.aoyama.ac.jp>2019-06-13 15:30:03 +0900
commit7f79a86d8b4d250ea0e82eb06cd3336edb840a01 (patch)
treecfe7febdafdbd05188dea07af5494e2c8233a308 /array.c
parent2a26c1ea24ec107cfb43d8561ad28984846b7660 (diff)
add comments to mention sort.reverse!
For array.c (Array#sort) and enum.c (Enumerable#sort_by), add comments mentioning that sort.reverse! / sort_by { ... }.reverse! can/should be used to reverse the result. [ci skip]
Diffstat (limited to 'array.c')
-rw-r--r--array.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/array.c b/array.c
index 37a6b2b581..de2f80828a 100644
--- a/array.c
+++ b/array.c
@@ -2819,6 +2819,11 @@ rb_ary_sort_bang(VALUE ary)
* ary.sort #=> ["a", "b", "c", "d", "e"]
* ary.sort {|a, b| b <=> a} #=> ["e", "d", "c", "b", "a"]
*
+ * To produce the reverse order, the following can also be used
+ * (and may be faster):
+ *
+ * ary.sort.reverse! #=> ["e", "d", "c", "b", "a"]
+ *
* See also Enumerable#sort_by.
*/