From: "mame (Yusuke Endoh)" Date: 2012-03-25T15:15:23+09:00 Subject: [ruby-core:43616] [ruby-trunk - Feature #4514][Assigned] #deep_clone and #deep_dup for Objects Issue #4514 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to matz (Yukihiro Matsumoto) ---------------------------------------- Feature #4514: #deep_clone and #deep_dup for Objects https://bugs.ruby-lang.org/issues/4514#change-25113 Author: wardrop (Tom Wardrop) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: =begin There's often a need to do a deep clone of an object, especially of Hash/Array trees. The typical work around to the lack of this functionality is to Marshall and then Unmarshall (e.g. Marshal::load(Marshal::dump(self)) ), which incurs more overhead than it probably should, and is not very semantic. My suggestion is to either provide #deep_clone and #deep_dup methods on the Object class, or to at least provide equivalent functionality for Hashes and Arrays, such as possibly a #deep_merge method for Hash. The exact implantation is not a large concern of mine; I'll let the experts determine the best method of achieving the desired outcome. =end -- http://bugs.ruby-lang.org/