From: nobu.nokada@... Date: 2004-01-28T20:01:47+09:00 Subject: Re: Does a function like pythons dir() excist for ruby ? Hi, At Wed, 28 Jan 2004 19:54:53 +0900, Asbj�rn Reglund Thorsen wrote: > I am using interactive Ruby for quick testing my swigged c++ module. In > python i can write down the command dir(), and I will get what`s inside > the module. Is there a similar function for Ruby ? $ ri instance_methods ------------------------------------------------ Module#instance_methods mod.instance_methods(include_super=false) => array ------------------------------------------------------------------------ Returns an array containing the names of public instance methods in the receiver. For a module, these are the public methods; for a class, they are the instance (not singleton) methods. With no argument, or with an argument that is +false+, the instance methods in _mod_ are returned, otherwise the methods in _mod_ and _mod_'s superclasses are returned. module A def method1() end end class B def method2() end end class C < B def method3() end end A.instance_methods #=> ["method1"] B.instance_methods #=> ["method2"] C.instance_methods #=> ["method3"] C.instance_methods(true).length #=> 43 A.instance_methods #=> ["method1"] B.instance_methods #=> ["method2"] C.instance_methods #=> ["method3"] C.instance_methods(true).length #=> 43 -- Nobu Nakada