[前][次][番号順一覧][スレッド一覧]

ruby-changes:33158

From: marcandre <ko1@a...>
Date: Sun, 2 Mar 2014 10:55:36 +0900 (JST)
Subject: [ruby-changes:33158] marcandRe: r45237 (trunk): * proc.c: Modify rdoc of Proc#arity to fit with current behavior.

marcandre	2014-03-02 10:55:33 +0900 (Sun, 02 Mar 2014)

  New Revision: 45237

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45237

  Log:
    * proc.c: Modify rdoc of Proc#arity to fit with current behavior.
      See #5694

  Modified files:
    trunk/proc.c
Index: proc.c
===================================================================
--- proc.c	(revision 45236)
+++ proc.c	(revision 45237)
@@ -839,11 +839,14 @@ rb_proc_call_with_block(VALUE self, int https://github.com/ruby/ruby/blob/trunk/proc.c#L839
  *  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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]