From: Gavin Sinclair Date: 2003-01-02T23:04:47+09:00 Subject: Re: ENV.clear On Friday, January 3, 2003, 12:49:27 AM, TOTO wrote: > The update method will return a copy of the new Hash or a copy of the > reference of the new Hash? How did you find out? I couldn't find it in > the Ruby reference. 'ri' - the Ruby programmer's friend. You need it. :) It's a destructive method. Look for 'ri' in the RAA. > To be honest, I have a stupid thought originally, before I know I can > use update method. I think I should implement an insert method for > class Hash to do the same thing. And then I find that it might be > impossible to do it with Ruby itself, because the class Hash is > implemented in c. Nothing is impossible. You can add methods to the Hash class. Generally the method you add will be implemented in terms of the existing methods. If #update didn't exist, you could add it thus (untested): class Hash def update(other) other.each do |key, value| self[key] = value end end end Gavin