From: nobu.nokada@... Date: 2003-12-13T11:34:21+09:00 Subject: Re: Q: introspection Hi, At Sat, 13 Dec 2003 11:06:59 +0900, Mike Hall wrote: > Is there a way to find out the methods that a given class/modules provides, > without including the methods from Object, Kernel, etc, and without deleting > any commonly named methods? > > For example, the Dir class, (Dir.methods - Object.methods) will remove the 'new' > method, and the 'open' method gets tossed if we subract out the Kernel.methods. > > Is this possible with the current set of 'public_methods' and 'private_methods' et.al? In 1.8, public_methods et al take an optional argument which directs that inherited methods are included or not. $ ruby -rpp -e 'pp Dir.public_methods(false)' ["glob", "superclass", "entries", "pwd", "[]", "foreach", "open", "rmdir", "delete", "getwd", "new", "mkdir", "chdir", "allocate", "chroot", "unlink"] -- Nobu Nakada