
Question:
Is there any method or something x
in which, provided z = lambda {|x, y, z| nil}
we can say
z.x #=> 3
Of course, syntax can differ if it gets the job done. Thank you!
Solution:1
Yes.
z.arity #=> 3
Solution:2
The Proc#arity
method tells you this:
ruby-1.9.1-p378 > f = lambda { |x,y,z| nil } => #<Proc:0x000001009ca830@(irb):1 (lambda)> ruby-1.9.1-p378 > f.arity => 3
Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
EmoticonEmoticon