ruby-changes:65365
From: usa <ko1@a...>
Date: Sun, 28 Feb 2021 23:37:49 +0900 (JST)
Subject: [ruby-changes:65365] aa19f11dbd (ruby_2_6): merge revision(s) 3c93ed59: [Backport #16514]
https://git.ruby-lang.org/ruby.git/commit/?id=aa19f11dbd From aa19f11dbdbaf06afc1a7f053d9bcd26e718ffb3 Mon Sep 17 00:00:00 2001 From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Sun, 28 Feb 2021 14:37:37 +0000 Subject: merge revision(s) 3c93ed59: [Backport #16514] Update documentation for Array/Hash Argument section of methods.rdoc [Bug #16514] --- doc/syntax/methods.rdoc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- doc/syntax/methods.rdoc | 15 +++++++++++++-- version.h | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/syntax/methods.rdoc b/doc/syntax/methods.rdoc index a47c1a3..5d070f8 100644 --- a/doc/syntax/methods.rdoc +++ b/doc/syntax/methods.rdoc @@ -355,12 +355,23 @@ converted to an Array: https://github.com/ruby/ruby/blob/trunk/doc/syntax/methods.rdoc#L355 gather_arguments 1, 2, 3 # prints [1, 2, 3] -The array argument must be the last positional argument, it must appear before -any keyword arguments. +The array argument must appear before any keyword arguments. + +It is possible to gather arguments at the beginning or in the middle: + + def gather_arguments(first_arg, *middle_arguments, last_arg) + p middle_arguments + end + + gather_arguments 1, 2, 3, 4 # prints [2, 3] The array argument will capture a Hash as the last entry if a hash was sent by the caller after all positional arguments. + def gather_arguments(*arguments) + p arguments + end + gather_arguments 1, a: 2 # prints [1, {:a=>2}] However, this only occurs if the method does not declare any keyword arguments. diff --git a/version.h b/version.h index a4964a7..d08a24b 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1 #define RUBY_VERSION "2.6.7" #define RUBY_RELEASE_DATE "2021-02-28" -#define RUBY_PATCHLEVEL 159 +#define RUBY_PATCHLEVEL 160 #define RUBY_RELEASE_YEAR 2021 #define RUBY_RELEASE_MONTH 2 -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/