From: Ned Konz Date: 2002-07-10T10:03:36+09:00 Subject: Re: Accessing caller's binding? On Tuesday 09 July 2002 05:10 pm, Philip Mak wrote: > Observe the following piece of > code, which looks like it should work but doesn't: > > > $ ruby -e"eval 'x = 3'; puts x" > -e:1: undefined local variable or method `x' for > # (NameError) > > > Does anyone have ideas on how I could create such a function, or am > I trying to do the impossible? I want to minimize the amount of > code that has to be typed by the caller. class CGI < Hash def initialize self['name']=['fred', nil] self['email']=['joe@pete.com', nil] self['phone']=['000-0000', nil] end def export(toWhom, names) toWhom.instance_eval("class <