From: "Jan E." Date: 2012-12-12T19:23:13+09:00 Subject: Re: How I can create/extract a variable/hash into the current binding in Ruby? Hi, I'm no expert on this stuff, but I think it's a problem of the Ruby interpreter determining variables while it parses the code: eval 'x = 1' puts x This doesn't work, because the parser doesn't "see" the eval stuff. It doesn't find an assignment for "x", so it assumes it's a method (which leads to a NameError). If, however, you set "x" to an arbitrary value beforehands, it correctly regognizes "x" as a variable: x = nil eval 'x = 1' puts x Apart from the technical stuff: I don't find it a good idea to just dump variables into a binding, because it's just too much "magic". It makes it hard to keep track of which variable has which value. And I can't think of any good reason to do that when you're programming object-oriented. Did you get the idea from PHP? Because that language is notorious for dumping values into all kinds of contexts, which has lead and still leads to gigantic security problems. -- Posted via http://www.ruby-forum.com/.