From: "Wayne E. Seguin" Date: 2007-08-09T22:30:44+09:00 Subject: Re: Deep Clone of array? --Apple-Mail-2-53145937 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Aug 09, 2007, at 04:13 , Ronald Fischer wrote: > Is there a standard way of doing a deep copy of an object (in > particular, of an array)? > > http://www.ruby-doc.org/core/classes/Object.html#M000379 mentions a > function 'dclone', > but this doesn't seem to exist: > > undefined method `dclone' Ronald, I don't know about a "standard" way, however the method that I use to deep copy uses built in constructs: hashish = { :a => "a", :b => "b", :c => ["a","b","c"] } # some arbitrary object with references to other objects hashish_deep_copy = Marshal.load( Marshal.dump( hashish ) ) hashish_deep_copy will then be a deep copy of hashish. Hope this helps, ~Wayne s///g Wayne E. Seguin Sr. Systems Architect & Systems Administrator --Apple-Mail-2-53145937--