From: Dave Thomas Date: 2003-06-22T22:10:39+09:00 Subject: Re: [Q] How to test if a file exists? Mike Campbell wrote: >>In an ideal world, I suppose I should follow my way up the inheritance >>tree, but that would make method lists very long. > > > To take that to its absurd conclusion, if ri reported NO methods, the list would > be very short indeed. ri reports the methods in a class or module, so I'm not sure I see this as being a valid end-point in a thought experiment. However... > IMHO, ri should follow all the way up; if the information there isn't complete, > it seems much less useful. (Javadoc, for example, at least lists what methods a > class is inheriting so you know at least what's there (and where to look) even > if there isn't a full-on description.) > > No? Well, try it for yourself. Let's say you wanted the methods for a Proc object. Here's ri's output ------------------------------------------------------------------------ [], arity, binding, call, new, to_proc, yield ------------------------------------------------------------------------ and here is what you're asking for: ------------------------------------------------------------------------ == === =~ [] __id__ __send__ arity binding call class clone display dup eql? equal? extend freeze frozen? hash id inspect instance_eval instance_of? instance_variable_get instance_variable_set instance_variables is_a? kind_of? method methods nil? object_id private_methods protected_methods public_methods respond_to? send singleton_methods taint tainted? to_a to_proc to_s type untaint yield ------------------------------------------------------------------------ (Note that both of these are slightly out of date wrt 1.8: 'yield' no longer exists as a method of Proc) It just seemed to me when I was writing ri that the former was a clearer picture of the essence of 'Proc'. However, I'm very open to suggestions here. Cheers Dave