Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 52d5bcc85b0cb1d8a86b471418818bcca27071a6 Mon Sep 17 00:00:00 2001
- From: Jack Dempsey <jack.dempsey@gmail.com>
- Date: Tue, 16 Sep 2008 18:25:23 -0400
- Subject: [PATCH] Add in deep_clone method
- ---
- lib/extlib/object.rb | 7 +++++++
- 1 files changed, 7 insertions(+), 0 deletions(-)
- diff --git a/lib/extlib/object.rb b/lib/extlib/object.rb
- index 2414fe4..2dd985f 100644
- --- a/lib/extlib/object.rb
- +++ b/lib/extlib/object.rb
- @@ -136,6 +136,13 @@ class Object
- self.dup
- end
- + # Performs a deep clone of an object
- + #
- + # @return <Object>
- + def deep_clone
- + Marshal::load(Marshal.dump(self))
- + end
- +
- # @param arrayish<#include?> Container to check, to see if it includes the object.
- # @param *more<Array>:: additional args, will be flattened into arrayish
- #
- --
- 1.5.5.1
Add Comment
Please, Sign In to add comment