D
David Garamond
I need to produce deep copies of an object structure (the elements will
only be hashes, arrays, symbols, strings, numbers, true/false, nils; and
not "complex" stuffs like File object or database connection handles).
Will this do fine?
def deep_clone(obj)
Marshal.load(Marshal.dump(obj))
end
Any gotchas I should know?
only be hashes, arrays, symbols, strings, numbers, true/false, nils; and
not "complex" stuffs like File object or database connection handles).
Will this do fine?
def deep_clone(obj)
Marshal.load(Marshal.dump(obj))
end
Any gotchas I should know?