From: Luke Ivers Date: 2007-02-09T05:03:04+09:00 Subject: Re: Help optimizing Gavin Kistner wrote: > On Feb 8, 12:42 pm, Luke Ivers wrote: >> if parent == '' >> end >> end >> return ret.chomp('&') >> end >> end > > I realize the code is there, but I'm having trouble figuring out what > it's used for. Could you describe what 'parent' is, and what it means > to have nested hashes? For {:test => 'testing'} the return should be test=testing For {:test => {:test => 'testing'}} it should be test[test]=testing Any nested hashes past that point should just continue to be added on as an array reference: {:test => {:test => {:test => 'testing'}}} => test[test][test] = testing > > One guess I have at improving the speed it to change: > self.keys.each{ |key| > # repeated function calls needed for self[key] > } > to > self.each_pair{ |key,value| > # direct references to value > } That one helps. -- Posted via http://www.ruby-forum.com/.