From: ara.t.howard@... Date: 2006-09-22T03:11:15+09:00 Subject: Re: Ducktator - A Duck Type Validator On Fri, 22 Sep 2006, Eric Mahurin wrote: > No reason to go change the API... it doesn't really - it's totaly backward compatible - it just happens to return a method/proc object instead of true, but that wouldn't break anything. > If you want to get the arity of a method, you simply use #method to get the > method object and use arity on that. If you overrode #method along with > #method_missing, you could still implement this same behaviour. You might > make #method return a Proc instead of a Method for those cases, but it > shouldn't make much difference. So, these should really be overridden > together: > > method_missing > respond_to? > method > > You could put most of your logic in #method and have #method_missing and > #respond_to? use it. interesting idea. of course my approach is just that - an idea. i actually thought about that but decided against it because, although Method and Proc objects both support arity, only method objects can be called with blocks so, returning a Proc from self.method() would change, and possible break, the api. of course - that's going to change in a newer ruby, and it's a really nice idea. cheers. -a -- in order to be effective truth must penetrate like an arrow - and that is likely to hurt. -- wei wu wei