| Short description: |
Add method for deep clone |
| Category: |
Library/Language |
| Status: |
experimental |
| Created: |
2007-04-13 07:52:53 GMT |
| Last update: |
2007-04-17 15:45:31 GMT |
| Owner: |
pegacorn
(Projects of this owner) |
| Homepage: |
http://d.hatena.ne.jp/pegacorn/20070418/1176824538 |
| Download: |
not available
|
| License: |
Ruby's |
| Dependency: |
|
| Description: |
Add method for deep clone
example:
class Foo
end
class Bar
end
obj1 = [Foo.new, Bar.new]
p obj1 # => [#<Foo:0x100ed494>, #<Bar:0x100ed480>]
p obj1.clone # => [#<Foo:0x100ed494>, #<Bar:0x100ed480>]
p obj1.deep_clone # => [#<Foo:0x100ed340>, #<Bar:0x100ed318>]
obj2 = {Foo.new => Bar.new, Foo.new => Bar.new}
p obj2 # => {#<Foo:0x100ed3a4>=>#<Bar:0x100ed390>, #<Foo:0x100ed37c>=>#<Bar:0x100ed368>}
p obj2.clone # => {#<Foo:0x100ed3a4>=>#<Bar:0x100ed390>, #<Foo:0x100ed37c>=>#<Bar:0x100ed368>}
p obj2.deep_clone # => {#<Foo:0x100ed188>=>#<Bar:0x100ed160>, #<Foo:0x100ed138>=>#<Bar:0x100ed110>}
|
| Versions: |
[0.2.1 (2007-04-17)]
[0.2 (2007-04-17)]
[0.1 (2007-04-13)]
|