From 7c8a060b8521bf071b2340f7f7b2e7b482b693cd Mon Sep 17 00:00:00 2001 From: stomar Date: Sat, 3 Jun 2017 20:17:00 +0000 Subject: [PATCH] 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 --- array.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/array.c b/array.c index 2e57572284..bd13a53430 100644 --- a/array.c +++ b/array.c @@ -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. */