зеркало из https://github.com/github/ruby.git
* proc.c: Modify rdoc of Proc#arity to fit with current behavior.
See #5694 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
04042ec6eb
Коммит
9b7b441687
11
proc.c
11
proc.c
|
@ -839,11 +839,14 @@ rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE pass_proc
|
|||
* call-seq:
|
||||
* prc.arity -> fixnum
|
||||
*
|
||||
* Returns the number of arguments that would not be ignored. If the block
|
||||
* Returns the number of mandatory arguments. If the block
|
||||
* is declared to take no arguments, returns 0. If the block is known
|
||||
* to take exactly n arguments, returns n. If the block has optional
|
||||
* arguments, return -n-1, where n is the number of mandatory
|
||||
* arguments. A <code>proc</code> with no argument declarations
|
||||
* to take exactly n arguments, returns n.
|
||||
* If the block has optional arguments, returns -n-1, where n is the
|
||||
* number of mandatory arguments, with the exception for blocks that
|
||||
* are not lambdas and have only a finite number of optional arguments;
|
||||
* in this latter case, returns n.
|
||||
* A <code>proc</code> with no argument declarations
|
||||
* is the same a block declaring <code>||</code> as its arguments.
|
||||
*
|
||||
* proc {}.arity #=> 0
|
||||
|
|
Загрузка…
Ссылка в новой задаче