On Feb 20, 2007, at 12:52 PM, Tim Pease wrote:

> In the more general case, you would need to use one of the 'eval'
> methods in order to create a new local variable in a local namespace.
> However, (1) the 'eval' methods work only on strings and not blocks,
> and (2) they are mostly evil and should be handled with great care.

eval() introduces a new scope, so local variables created in that  
context do not leak into the calling scope:

 >> def test_eval
 >>   eval("name = 'James'", binding)
 >>   name
 >> end
=> nil
 >> tes
test       test_eval
 >> test_eval
NameError: undefined local variable or method `name' for main:Object
         from (irb):3:in `test_eval'
         from (irb):5
         from :0

James Edward Gray II