From: "Mauricio Fernández" Date: 2005-11-17T03:04:26+09:00 Subject: Re: Proposed RCR: Object#replace On Thu, Nov 17, 2005 at 02:51:47AM +0900, Austin Ziegler wrote: > On the Sydney list, Daniel Berger has been asking about a generic > Object#replace call to work similarly to Hash#replace, String#replace, > and Array#replace. I see no reason that this could not be implemented > for all objects. At a simplistic level, this is: > > class Object > def replace(other) > other.instance_variables.each do |name| > instance_variable_set(name, other.instance_variable_get(name)) > end > end > end What about singleton methods? Will Sydney relax the rebinding rules? -- Mauricio Fernandez