From: Phrogz Date: 2006-09-02T06:50:36+09:00 Subject: Re: How can I ask to which module a method belongs to? > irb(main):001:0> load 'moddefining.rb' > => true > irb(main):002:0> String.module_defining('==') > => String > irb(main):003:0> String.module_defining('id') > => Kernel > irb(main):004:0> String.module_defining('map') > => Enumerable Sexy! :) IMO something like this would make a nice addition to the core library. Jumping through hoops for introspection is no fun. (At least this one doesn't involve any string parsing.) Note that the Method#inspect method gives you this same information in string form: irb(main):001:0> "".method( :== ) => # irb(main):002:0> String.instance_method( :== ) => # irb(main):003:0> "".method( :id ) => # irb(main):004:0> String.instance_method( :id ) => # irb(main):005:0> "".method( :map ) => # irb(main):006:0> String.instance_method( :map ) => # Less or more reliable to use this with string parsing? Perhaps slightly more, if only to be sure that the method resolution order is properly followed.