Class Methods

One solution would be to use ruby-array's "set-like" functionality:

onlyClassBMethods = ClassB.instance_methods - ClassA.instance_methods

Don't know if this is what you're looking for?

Regards,
Helge Elvik

···

-----Original Message-----
From: Michael Gorsuch [mailto:michael.gorsuch@gmail.com]
Sent: 8. mai 2006 15:00
To: ruby-talk ML
Subject: Class Methods

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?

Edwin, Helge - thank you.

I can't believe I didn't put that together.

Have a great day.

···

On 5/8/06, Helge Elvik <helge.elvik@gispartner.no> wrote:

One solution would be to use ruby-array's "set-like" functionality:

onlyClassBMethods = ClassB.instance_methods - ClassA.instance_methods

Don't know if this is what you're looking for?

Regards,
Helge Elvik

-----Original Message-----
From: Michael Gorsuch [mailto:michael.gorsuch@gmail.com]
Sent: 8. mai 2006 15:00
To: ruby-talk ML
Subject: Class Methods

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?