From: Phrogz Date: 2009-11-19T14:15:20+09:00 Subject: Re: How to overide "include" method? On Nov 18, 10:47 am, Alexandre Mutel wrote: > Gavin Kistner wrote: > But when i'm trying to use it from the irb prompt, but the overloaded > include it's not called... > Is there a way to found from where the method is define? ( with > method(:include).something?), so i know where to define the overload... Apparently not, since method(:include).source_location returns nil. But you can see that the include at the top level is custom for main, not the same include from modules: irb(main):001:0> class Foo; end => nil irb(main):002:0> [ method(:include), method(:include).owner ] => [#, #>] irb(main):003:0> [ Foo.method(:include), Foo.method(:include).owner ] => [#, Module] > So from the top level, where i can overload this "include" method? Good question. I'm not sure where main fits into the method lookup flow. (But if someone tells me, I'll add it to the diagram :)