From: 7stud -- Date: 2011-04-15T02:07:50+09:00 Subject: Re: Copying parameters to singleton class Lars Olsson wrote in post #992715: > On 14 Apr, 03:09, 7stud -- wrote: >> > old_options[key] = new_options[key] >> >> old_options.has_key?(key) >> end.freeze >> end >> end >> >> -- >> Posted viahttp://www.ruby-forum.com/. > > Hi! > > Even though I agress that using the same name for both the local > parameter and a method with the same name might be a bad idea, my code > still works without any problem. If I redefine self using to: > There's working code, and there's clear code. The goal: working code that is clear! > Hmmm...why can you merge() but not directly assign to > individual keys when a hash is frozen? Duh. Because merge() produces a new hash--it doesn't change the frozen hash. -- Posted via http://www.ruby-forum.com/.