Method not from ancestor

Hi,

When I use the #methods call to find out what method a class/object
support, it reports methods from all ancestors. This is right, but how
can I tell if a method is defined in this class, or from its ancestor?

I am thinking of using the & operator of array, but it gives the common
part of 2 sets, how can we find out the difference part? Is there a
simpler way to acomplish this simple task?

Tks.
Shannon

Hi,

When I use the #methods call to find out what method a class/object
support, it reports methods from all ancestors. This is right, but how
can I tell if a method is defined in this class, or from its ancestor?

I am thinking of using the & operator of array, but it gives the common
part of 2 sets, how can we find out the difference part? Is there a
simpler way to acomplish this simple task?

Tks.
Shannon

Hi,
you could even use

  • Class.instance_methods that gives you the methods in the object
  • Class.singleton_methods to get the Class specific methods

Hope I helped

ยทยทยท

On Thu, 5 Dec 2002 08:32:54 +0900, Shannon Fang xrfang@hotmail.com wrote: