diff options
author | Martin Dürst <duerst@it.aoyama.ac.jp> | 2019-06-13 15:30:03 +0900 |
---|---|---|
committer | Martin Dürst <duerst@it.aoyama.ac.jp> | 2019-06-13 15:30:03 +0900 |
commit | 7f79a86d8b4d250ea0e82eb06cd3336edb840a01 (patch) | |
tree | cfe7febdafdbd05188dea07af5494e2c8233a308 /enum.c | |
parent | 2a26c1ea24ec107cfb43d8561ad28984846b7660 (diff) | |
download | ruby-7f79a86d8b4d250ea0e82eb06cd3336edb840a01.tar.gz |
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 'enum.c')
-rw-r--r-- | enum.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1220,6 +1220,10 @@ sort_by_cmp(const void *ap, const void *bp, void *data) * * sorted = Dir["*"].sort_by { |f| test(?M, f) } * sorted #=> ["mon", "tues", "wed", "thurs"] + * + * To produce the reverse of a specific order, the following can be used: + * + * ary.sort_by { ... }.reverse! */ static VALUE |