Hey guys. How do I know the methods that a child class overrided in my super class? I have this:
class Test def self.inherited(child) # child.overrided_methods??? end def self.foo end def self.bar end end def Child < Test def self.bar puts "bar" end end
The method self.inherited is called when a subclass of Test is loaded. So I get the reference to this subclass in child, but I don't know how to get the methods that were overrided by this subclass.
Any ideas?
--
Arsen suggested the use of self.method_added(name) instead of self.inherited(child), but this method catches only instance methods and I want to catch class methods. Does anyone know another methods that does the same thing but with class methods? In the last case I'll consider using a singleton and convert all this class methods to instance methods then the problem is solved.
Child
's methods fromTest
? – Reese MooreChild.methods(false) & Test.methods(false)
"? The problem is: when do you want to call it? 'Inherited' is called too early. – Arsen7