B
bp50fathoms
Hi all,
I'd like to distinguish the two following blocks by means of their
arity, but in Ruby 1.8 I don't see how to do this as Proc#arity
returns the same value.
lambda {}.arity => -1
lambda {|*a|}.arity => -1
This is not the case in 1.9 as the semantics of the first one has
changed, and now it's equivalent to lambda {||}. Both return 1 and
complain when the number of arguments passed is not correct.
Any ideas?
Thanks in advance.
I'd like to distinguish the two following blocks by means of their
arity, but in Ruby 1.8 I don't see how to do this as Proc#arity
returns the same value.
lambda {}.arity => -1
lambda {|*a|}.arity => -1
This is not the case in 1.9 as the semantics of the first one has
changed, and now it's equivalent to lambda {||}. Both return 1 and
complain when the number of arguments passed is not correct.
Any ideas?
Thanks in advance.