Class: Object

Inherits:
BasicObject
Defined in:
lib/tagen/core/object.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) deepdup

default #dup is shallow.

Examples:

# dup
a={a: { b: 1 }}
a2 = a.dup
a2[:a][:b] = 2
p a  #=> {a: {b: 2} }

# use deepdup
a= {a: {b: 1 }}
a2 = a.deepdup
a2[:a][:b] = 2
p a #=> {a: {b: 1}}

Returns:



18
19
20
# File 'lib/tagen/core/object.rb', line 18

def deepdup
	Marshal.load(Marshal.dump(self))
end