How to get the method name

I need to get the method name automatically like we do with the classes:

puts self.class.to_s()

I’m trying: self.method.to_s() or self.class.method.to_s() but it
doesn’t work.

I don’t think I’ve got your question exactly, but
self.methods returns an array of all methods defined in self.
If not exactly what you want, probably
one of the Object class methods for self inspection is what you are
looking for.
-Carlos

On Tue, 15 Jan 2008 01:14:18 +0900, “Mario R.” [email protected]
said:

Hi Mario,

have a look at this thread:

http://www.ruby-forum.com/topic/75258

For pre ruby 1.9 you’ll have to use a work-around.

cheers

Thibaut

Thank you very much.

Thibaut Barrère wrote:

Hi Mario,

have a look at this thread:

Using the current method name within current method - Ruby - Ruby-Forum

For pre ruby 1.9 you’ll have to use a work-around.

cheers

Thibaut