mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add documentation regarding keyword argument separation [ci skip]
This commit is contained in:
parent
12e27a411c
commit
c7715a4936
2 changed files with 97 additions and 1 deletions
|
@ -279,6 +279,9 @@ hash at the end of the array into keyword arguments:
|
|||
arguments = [1, 2, { c: 4 }]
|
||||
my_method(*arguments)
|
||||
|
||||
Note that this behavior is currently deprecated and will emit a warning.
|
||||
This behavior will be removed in Ruby 3.0.
|
||||
|
||||
You may also use the <code>**</code> (described next) to convert a Hash into
|
||||
keyword arguments.
|
||||
|
||||
|
@ -325,7 +328,7 @@ by <code>*</code>:
|
|||
|
||||
Prints:
|
||||
|
||||
{:arguments=>[1, 2, {"3"=>4}], :keywords=>{:five=>6}}
|
||||
{:arguments=>[1, 2], :keywords=>{'3'=>4, :five=>6}}
|
||||
|
||||
=== Proc to Block Conversion
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue