From: Kristof Bastiaensen Date: 2004-04-21T21:09:16+09:00 Subject: Re: binding - how to get current script? On Wed, 21 Apr 2004 12:18:18 +0200, Szymon Drejewicz wrote: > >> A local variable created in eval is only visible in eval. > > :'-( > > so there is no way to do something like: > > eval("name = 'Alice'", MAIN_BINDING) > puts name > There is :-) You can use Kernel#binding to get the current binding, and pass it to eval: irb(main):001:0> eval("name = 'Alice'", binding()) => "Alice" irb(main):002:0> name => "Alice"