From: "R.Seymour" Date: 2002-04-20T03:09:32+09:00 Subject: Re: String to method name On Fri, 19 Apr 2002 13:25:22 -0400, ts wrote: >>>>>> "R" == R Seymour writes: > > R> <<>>[badGuyShow] = badGuy > > You have not given enough information. Imagine this example > > def change_monkey(gt, gs, g) > # how do you want to access, in this method, the local variable > # mutantMonkey, with only `gt', `gs', `g' > end > > badGuyType = "mutantMonkey" > badGuyShow = "powerPuffGirls" > badGuy = "Mojo Jojo" > SenselessNames = Struct::new( :powerPuffGirls ) mutantMonkey = > SenselessNames.new > > change_monkey(badGuyType, badGuyShow, badGuy) > > > > In #change_monkey it's not possible to access the local variable > `mutantMonkey' (because it's defined outside of the def) > > > > Guy Decoux I realize that, but I'm not going to do any changing. The gist of what I'm trying to do is this, have a something like this in perl: SenslessNames{badGuyType}{badGuyShow} = badGuy; So you could do a lookup by type and show and get a given badGuy string returned. Can you do multidimensional (double key) hashes in Ruby? I feel like there should be some obvious way of doing this that would totally flip the script, jump outside the box, subvert the paradigm, etc. etc. :) Thanks for your patience, even if you're out of it. -Rich