From: "NARUSE, Yui" Date: 2011-12-05T05:02:29+09:00 Subject: [ruby-core:41482] Re: [ruby-trunk - Bug #5694][Open] Proc#arity doesn't take optional arguments into account. (2011/12/04 12:41), NARUSE, Yui wrote: > (2011/12/03 4:20), Yehuda Katz wrote: >> Yeah��� it would be nice to be able to do: >> >> if proc.arity_range.include?(2) >> if method.arity_range.include?(2) > > Is it really required way? > > For example you want to know whether you can obj.meth(a, b) or not, > it should be something like obj.callable?(:meth, a, b), shouldn't it? After some consideration, I'm wondering why following code is not used. There is already a method or proc object in usual use case? begin obj.__send__(callback, attributes) rescue ArgumentError obj.__send__(callback) end -- NARUSE, Yui