Can I pass variables to eval?

Posted by Nick on Stack Overflow See other posts from Stack Overflow or by Nick
Published on 2010-06-08T04:04:28Z Indexed on 2010/06/08 4:12 UTC
Read the original article Hit count: 261

Filed under:

Hi,

I am trying to pass a variable to a dynamically declared method like:

eval(def test(name)
 puts name
end
test 'joe')

but it does not work.

Is there a way to do this?

© Stack Overflow or respective owner

Related posts about ruby