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

ruby-changes:62438

From: Jeremy <ko1@a...>
Date: Fri, 31 Jul 2020 04:41:40 +0900 (JST)
Subject: [ruby-changes:62438] a6bfc951aa (master): Document Array#flatten{, !} accept explicit nil argument [ci skip]

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

From a6bfc951aa9c48e2a4608a9ae84e2e3b4fd9b390 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Thu, 30 Jul 2020 12:39:54 -0700
Subject: Document Array#flatten{,!} accept explicit nil argument [ci skip]

Fixes [Bug #10475]

diff --git a/array.c b/array.c
index 31acc57..4b655c6 100644
--- a/array.c
+++ b/array.c
@@ -7026,7 +7026,7 @@ flatten(VALUE ary, int level) https://github.com/ruby/ruby/blob/trunk/array.c#L7026
  *  Replaces each nested \Array in +self+ with the elements from that \Array;
  *  returns +self+ if any changes, +nil+ otherwise.
  *
- *  Argument +level+, if given, must be an
+ *  Argument +level+, if given and not +nil+, must be an
  *  {Integer-convertible object}[doc/implicit_conversion_rdoc.html#label-Integer-Convertible+Objects].
  *
  *  With non-negative argument +level+, flattens recursively through +level+ levels:
@@ -7040,7 +7040,7 @@ flatten(VALUE ary, int level) https://github.com/ruby/ruby/blob/trunk/array.c#L7040
  *    a.flatten!(3) # => [0, 1, 2, 3, 4, 5]
  *    [0, 1, 2].flatten!(1) # => nil
  *
- *  With no argument,  or with negative argument +level+, flattens all levels:
+ *  With no argument, a +nil+ argument, or with negative argument +level+, flattens all levels:
  *    a = [ 0, [ 1, [2, 3], 4 ], 5 ]
  *    a.flatten! # => [0, 1, 2, 3, 4, 5]
  *    [0, 1, 2].flatten! # => nil
@@ -7094,7 +7094,7 @@ rb_ary_flatten_bang(int argc, VALUE *argv, VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L7094
  *  - Each non-Array element is unchanged.
  *  - Each \Array is replaced by its individual elements.
  *
- *  Argument +level+, if given, must be
+ *  Argument +level+, if given and not +nil+, must be
  *  {Integer-convertible object}[doc/implicit_conversion_rdoc.html#label-Integer-Convertible+Objects].
  *
  *  With non-negative argument +level+, flattens recursively through +level+ levels:
@@ -7107,7 +7107,7 @@ rb_ary_flatten_bang(int argc, VALUE *argv, VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L7107
  *    a = [ 0, [ 1, [2, 3], 4 ], 5 ]
  *    a.flatten(3) # => [0, 1, 2, 3, 4, 5]
  *
- *  With no argument, or with negative argument +level+, flattens all levels:
+ *  With no argument, a +nil+ argument, or with negative argument +level+, flattens all levels:
  *    a = [ 0, [ 1, [2, 3], 4 ], 5 ]
  *    a.flatten # => [0, 1, 2, 3, 4, 5]
  *    [0, 1, 2].flatten # => [0, 1, 2]
-- 
cgit v0.10.2


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

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