[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: How to run variable method names?

Matthew Harris

7/24/2006 5:51:00 AM

You would use `__send__' in the event `send' is overriden.

'neb'.__send__(:reverse) #=> 'ben'

On 7/24/06, Ben Johnson <bjohnson@contuitive.com> wrote:
> Lets say object has a method called id.
>
> How do I do the the following?
>
> method_name = "id"
> object.method_name
>
> I know the above doesnt work, but I want method_name to be replaced
> by its value so it would run id.
>
> Thanks for the help.
>
> Thank You,
> Ben Johnson
> E: bjohnson@contuitive.com
>
>
>
>
>


--
Matt