From 9b7b44168759ef764b60d9d297007958058694ee Mon Sep 17 00:00:00 2001 From: marcandre Date: Sun, 2 Mar 2014 01:55:33 +0000 Subject: * 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 --- proc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'proc.c') diff --git a/proc.c b/proc.c index de04f6d441..7a4131e17e 100644 --- a/proc.c +++ b/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 proc 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 proc with no argument declarations * is the same a block declaring || as its arguments. * * proc {}.arity #=> 0 -- cgit v1.2.3