From: Alexandre Mutel Date: 2009-11-19T02:47:01+09:00 Subject: Re: How to overide "include" method? Gavin Kistner wrote: > # Class methods of classes inherit from instance methods of > # the Class class before they inherit from instance methods of Module. > # http://phrogz.net/RubyLibs/RubyMethodLookupFlow.png Thanks! Your example is working well until i use it inside a class definition. 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... For example, if i put the class overloading in a separate file class_includer.rb class Class def include(*args) p "hi!" super end end And from the irb : require "class_includer" include "test" The method above is not called. It means that it's implemented elsewhere in this case (outside a class definition, in the top level). I tried to overload directly the include method in the irb, but it's not working as well, very strange... well, i have probably to understand more how scope on self is working! So from the top level, where i can overload this "include" method? -- Posted via http://www.ruby-forum.com/.