josh
1
Hi all
I know that classes are some sort of Constants in ruby. Now I have to
dynamically call a class’ method while the class’ name is in a string.
string = “MyCoolClass”
Now I wanna call MyCoolClass.my_cool_method but I only have the string
“string”. You know what I mean?
Thanks
Josh
josh
2
Joshua M. wrote:
string = “MyCoolClass”
Now I wanna call MyCoolClass.my_cool_method but I only have the string
“string”. You know what I mean?
string.constantize.my_cool_method
–
Jakob S. - http://mentalized.net
josh
3
On 9/25/06, Jakob S. [email protected] wrote:
Jakob S. - http://mentalized.net
Or in plain Ruby:
Object.const_get(“MyCoolClass”).my_cool_method
Max