[前][次][番号順一覧][スレッド一覧]

ruby-changes:63583

From: Yusuke <ko1@a...>
Date: Thu, 12 Nov 2020 17:00:26 +0900 (JST)
Subject: [ruby-changes:63583] a02ba60466 (master): array.rb: show examples whether `Array#shuffle!` has side effect or not

https://git.ruby-lang.org/ruby.git/commit/?id=a02ba60466

From a02ba60466500639af80e560fbf2311c6db70d8c Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Thu, 12 Nov 2020 16:56:15 +0900
Subject: array.rb: show examples whether `Array#shuffle!` has side effect or
 not

Partially revert 54fb8fb62a30c7b60ab6443a62821f6f8bc479c4

diff --git a/array.rb b/array.rb
index 36f4f0a..5ca1584 100644
--- a/array.rb
+++ b/array.rb
@@ -4,7 +4,8 @@ class Array https://github.com/ruby/ruby/blob/trunk/array.rb#L4
   #
   # Shuffles the elements of +self+ in place.
   #    a = [1, 2, 3] #=> [1, 2, 3]
-  #    a.shuffle! #=> [2, 3, 1]
+  #    a.shuffle!    #=> [2, 3, 1]
+  #    a             #=> [2, 3, 1]
   #
   # The optional +random+ argument will be used as the random number generator:
   #    a.shuffle!(random: Random.new(1))  #=> [1, 3, 2]
@@ -17,7 +18,8 @@ class Array https://github.com/ruby/ruby/blob/trunk/array.rb#L18
   #
   # Returns a new array with elements of +self+ shuffled.
   #    a = [1, 2, 3] #=> [1, 2, 3]
-  #    a.shuffle #=> [2, 3, 1]
+  #    a.shuffle     #=> [2, 3, 1]
+  #    a             #=> [1, 2, 3]
   #
   # The optional +random+ argument will be used as the random number generator:
   #    a.shuffle(random: Random.new(1))  #=> [1, 3, 2]
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]