diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-03-02 01:55:49 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-03-02 01:55:49 +0000 |
commit | 47d6a7ee1c87697d650f402fc0899e7407fc3e10 (patch) | |
tree | 952bc9341f7e79ab4e7f17280f772862d4e20f7a /proc.c | |
parent | 9b7b44168759ef764b60d9d297007958058694ee (diff) | |
download | ruby-47d6a7ee1c87697d650f402fc0899e7407fc3e10.tar.gz |
* proc.c: Complete rdoc of Proc#arity regarding keyword arguments.
See #8072 and #9299.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -846,6 +846,8 @@ rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE pass_proc * 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. + * Keywords arguments will considered as a single additional argument, + * that argument being mandatory if any keyword argument is mandatory. * A <code>proc</code> with no argument declarations * is the same a block declaring <code>||</code> as its arguments. * @@ -857,6 +859,8 @@ rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE pass_proc * proc { |*a| }.arity #=> -1 * proc { |a, *b| }.arity #=> -2 * proc { |a, *b, c| }.arity #=> -3 + * proc { |x:, y:, z:0| }.arity #=> 1 + * proc { |*a, x:, y:0| }.arity #=> -2 * * proc { |x=0| }.arity #=> 0 * lambda { |x=0| }.arity #=> -1 @@ -868,6 +872,8 @@ rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE pass_proc * lambda { |x, y=0| }.arity #=> -2 * proc { |(x, y), z=0| }.arity #=> 1 * lambda { |(x, y), z=0| }.arity #=> -2 + * proc { |a, x:0, y:0| }.arity #=> 1 + * lambda { |a, x:0, y:0| }.arity #=> -2 */ static VALUE |