diff options
author | stomar <stomar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-03 20:17:00 +0000 |
---|---|---|
committer | stomar <stomar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-03 20:17:00 +0000 |
commit | 7c8a060b8521bf071b2340f7f7b2e7b482b693cd (patch) | |
tree | ed9258d67eff27aa554ea60aa8602183cc732c91 | |
parent | 4bf1fc3a134a629c7861fd32b7d2753cf01a87c1 (diff) | |
download | ruby-7c8a060b8521bf071b2340f7f7b2e7b482b693cd.tar.gz |
array.c: docs for Array#{sort,sort!}
* array.c: [DOC] make example in the docs for Array#{sort,sort!}
match the call-seq and description by using the same block vars.
Based on a patch by Roque Pinel (repinel). [Fix GH-1628]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | array.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -2450,8 +2450,8 @@ sort_2(const void *ap, const void *bp, void *dummy) * elements returns +0+, the order of the elements is unpredictable. * * a = [ "d", "a", "e", "c", "b" ] - * a.sort! #=> ["a", "b", "c", "d", "e"] - * a.sort! { |x,y| y <=> x } #=> ["e", "d", "c", "b", "a"] + * a.sort! #=> ["a", "b", "c", "d", "e"] + * a.sort! { |a, b| b <=> a } #=> ["e", "d", "c", "b", "a"] * * See also Enumerable#sort_by. */ @@ -2534,8 +2534,8 @@ rb_ary_sort_bang(VALUE ary) * elements returns +0+, the order of the elements is unpredictable. * * a = [ "d", "a", "e", "c", "b" ] - * a.sort #=> ["a", "b", "c", "d", "e"] - * a.sort { |x,y| y <=> x } #=> ["e", "d", "c", "b", "a"] + * a.sort #=> ["a", "b", "c", "d", "e"] + * a.sort { |a, b| b <=> a } #=> ["e", "d", "c", "b", "a"] * * See also Enumerable#sort_by. */ |