On Mon, 2007-01-08 at 07:42 +0900, Trans wrote: > Hi-- > > Think I need a better name for this method. It is anything but > dangerous. Any ideas? > > # As with #store but adds the key/value pair > # only if the key isn't already in the hash. > > def store!(key, value) > unless key?(key) > store(key,value) > return value > end > end Is there really a need for such a method? Why not simply: hsh[:key] ||= "value" or, if you have a default value on your hash: hsh[:key] = "value" unless hsh.has_key? :key I'm positive you've thought about this, but I cannot find a reason why such a method should be necessary. Cheers, Daniel