From: Trans Date: 2007-01-08T09:48:03+09:00 Subject: Re: a most undangerous Hash#store! Daniel Schierbeck wrote: > Is there really a need for such a method? Why not simply: > > hsh[:key] ||= "value" This isn't quite the same becasue it looks to see if tha value is nil or false, not if the key is there or not. > or, if you have a default value on your hash: > > hsh[:key] = "value" unless hsh.has_key? :key Yes, certianly. nad that woul dbe fine if I were just needing here and ther, but I have need for using it quite often. > I'm positive you've thought about this, but I cannot find a reason why > such a method should be necessary. HTH, T.