Here's some simple code:
def ClassA
def my_method
end
end
def ClassB < ClassA
def my_new_method
end
end
···
-----------
What is the best way to get a list of instance methods for ClassB, but that
does not contain the parent class's methods?
ClassB.instance_methods is returning all of them. I just want to see
'my_new_method'.
Any ideas?
Michael Gorsuch wrote:
What is the best way to get a list of instance methods for ClassB, but
that
does not contain the parent class's methods?
ClassB.instance_methods is returning all of them. I just want to see
'my_new_method'.
ClassB.instance_methods - ClassB.superclass.instance_methods
···
--
Posted via http://www.ruby-forum.com/\.
ts1
(ts)
3
ClassB.instance_methods is returning all of them. I just want to see
'my_new_method'.
ClassB.instance_methods(false)
Guy Decoux