Daniel Schüle
3/8/2006 3:00:00 PM
Hello
Returns the number of arguments required by the block. If the block
takes no arguments, returns -1. If it takes one argument, returns -2.
Otherwise, returns a positive argument count unless the last argument is
prefixed with *, in which case the argument count is negated. The number
of required arguments is anInteger for positive values, and ( anInteger
+1).abs otherwise.
Proc.new {||}.arity » 0
Proc.new {|a|}.arity » -1 ### <<< error?
Proc.new {|a,b|}.arity » 2
Proc.new {|a,b,c|}.arity » 3
Proc.new {|*a|}.arity » -1
Proc.new {|a,*b|}.arity » -2
I would say it's a typo
Regards, Daniel