const_get but for variables

Posted by aharon on Stack Overflow See other posts from Stack Overflow or by aharon
Published on 2010-06-10T23:53:49Z Indexed on 2010/06/11 0:12 UTC
Read the original article Hit count: 231

Filed under:

So I know you can say Kernel.const_get("ClassName") and you'll get back the class to which the string corresponds in name. But what about for variables? Is there a way to do:

test = "heyas"
some_method_here("test") #=> "heyas"

Thanks so much

© Stack Overflow or respective owner

Related posts about ruby