From: Jason Creighton Date: 2003-07-22T02:03:51+09:00 Subject: Re: Deep copy On Mon, 21 Jul 2003 18:31:21 +0200 "Simon Strandgaard" <0bz63fz3m1qt3001@sneakemail.com> wrote: > On Tue, 22 Jul 2003 01:43:45 +0900, Jim Freeze wrote: > > > Hi > > > > I find that when I need to do a deep copy that I > > usually just do the following: > > > > x = Marshal.load(Marshal.dump(y) > > > > > > Is there a more concise (possibly faster) method that > > combines these two steps? If not, should we add one? > > How about this ? > > http://www.rubygarden.org/ruby?StandardClassExtensions/Object class Object def deep_clone Marshal::load(Marshal.dump(self)) end end Jason Creighton