From: "Ara.T.Howard" Date: 2005-11-17T04:52:17+09:00 Subject: Re: Proposed RCR: Object#replace On Thu, 17 Nov 2005, Trans wrote: >> i see where you are coming from, but wouldn't this more accurately be called >> something like Object#refer since all instance vars will then be shared? > > class Object > def replace(other) > other.instance_variables.each do |name| > o = other.instance_variable_get(name) > if o.respond_to? :clone > instance_variable_set(name, o.clone) > end > end > end > end sure - dangerous though, resources can leak and not everything supports clone. i like it mind you. -a -- =============================================================================== | ara [dot] t [dot] howard [at] gmail [dot] com | all happiness comes from the desire for others to be happy. all misery | comes from the desire for oneself to be happy. | -- bodhicaryavatara ===============================================================================