From: MonkeeSage Date: 2007-12-07T18:35:12+09:00 Subject: Re: Dynamic local vars On Dec 7, 2:19 am, Vasyl Smirnov wrote: > Hi, > > I wonder if there is any way to create local variables dynamically, > for example, given > > def foo > bar > puts x, y > end > > is it possible for bar to somehow create and initialize x and y? > Binding doesn't seem to be modifiable.. > > Or am I asking too much? :) There are probably more clever ways than this, but I'm dumb... def bar x = 10 y = 20 binding end def foo eval("puts x, y", bar) end Regards, Jordan