Skip to content

Instantly share code, notes, and snippets.

@ptzn
Created December 25, 2009 18:35
Show Gist options
  • Save ptzn/263709 to your computer and use it in GitHub Desktop.
Save ptzn/263709 to your computer and use it in GitHub Desktop.
object cloning #3
>> arr = [[4, 5, 6], 2, 3]
=> [[4, 5, 6], 2, 3]
>> arr1 = Marshal.load(Marshal.dump(arr))
=> [[4, 5, 6], 2, 3]
>> arr1[0] => [4, 5, 6, 7]
>> arr1
=> [[4, 5, 6, 7], 2, 3]
>> arr
=> [[4, 5, 6], 2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment