From: Nate Smith Date: 2004-09-28T22:04:37+09:00 Subject: Re: Changing outside variables inside a proc On Thu, 2004-09-16 at 14:36, Markus wrote: > On Thu, 2004-09-16 at 10:28, Nate Smith wrote: > > > Is there any way to change an outside-scoped object inside a proc? Such > > as: > > ........ > Why do you think this is needed (or nice) for writing a collect! > method? Why cant you just write something like: > > class My_collection_class > def [](k) > : > end > def []=(k,v) > : > end > def each_key > : > end > def collect! > each_key { |k| self[k] = yield(self[k]) } > end > end Very true indeed (that works great). I was more thinking about collecting for the key and the value in one swoop, but that may be more trouble than it's worth. Nate