ruby-changes:46896
From: stomar <ko1@a...>
Date: Sun, 4 Jun 2017 05:17:07 +0900 (JST)
Subject: [ruby-changes:46896] stomar:r59011 (trunk): array.c: docs for Array#{sort, sort!}
stomar 2017-06-04 05:17:00 +0900 (Sun, 04 Jun 2017) New Revision: 59011 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59011 Log: 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] Modified files: trunk/array.c Index: array.c =================================================================== --- array.c (revision 59010) +++ array.c (revision 59011) @@ -2450,8 +2450,8 @@ sort_2(const void *ap, const void *bp, v https://github.com/ruby/ruby/blob/trunk/array.c#L2450 * 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) https://github.com/ruby/ruby/blob/trunk/array.c#L2534 * 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. */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/