From: Johan Holmberg Date: 2001-11-01T06:45:38+09:00 Subject: [ruby-talk:24038] Re: No public methods in 'Object' ? On Thu, 1 Nov 2001, ts wrote: > > > $ ruby -e 'p Object.instance_methods(1).length' > > 37 > > pigeon% ruby -e 'p Kernel.instance_methods.length' > 37 > pigeon% > > pigeon% ruby -e 'p Object.instance_methods(1).length' > 37 > pigeon% > > > Kernel is a module which is included in Object, and where are defined > instance methods of Object > Thanks. Now when I reread about 'Object' in the Pickaxe-book I see that the inclusion of 'Kernel' is mentioned there. One of the reasons why I asked my original question is that I'm trying to figure out how to tell where each public method in a class is defined. I would like to be able to do: some_class = String # for example some_class.instance_methods(1).each { |m| defined_in = .... puts "method #{m} is defined in #{defined_in}" } I can't figure out what to write instead of "....". Is there some way to do this without duplicating Ruby's own search-algorithm among the ancestor classes and modules ? /johan holmberg