[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

how to get the method name

Mario Ruiz

1/14/2008 4:14:00 PM

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.
--
Posted via http://www.ruby-....

3 Answers

Carlos J. Hernandez

1/14/2008 4:30:00 PM

0

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 Ruiz" <mario@betware.com>
said:
> 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.
> --
> Posted via http://www.ruby-....
>

Thibaut Barrère

1/14/2008 4:32:00 PM

0

Hi Mario,

have a look at this thread:

http://www.ruby-forum.com/t...

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

cheers

Thibaut
--
http://blog... - about writing software
http://evolving... - tools for a better day

Mario Ruiz

1/15/2008 10:20:00 AM

0

Thank you very much.

Thibaut Barrère wrote:
> Hi Mario,
>
> have a look at this thread:
>
> http://www.ruby-...t...
>
> For pre ruby 1.9 you'll have to use a work-around.
>
> cheers
>
> Thibaut

--
Posted via http://www.ruby-....