summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-28 16:47:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-28 16:47:21 +0000
commitd9e84f2327f09bbc356871c6e72e5816654cff72 (patch)
treef756d2646cd96ef119ba254d6ec2cf970202dffc
parentd1499525d5ea9d0b2d372406d414ea3679a939fb (diff)
* lib/delegate.rb (Delegator#initialize_copy): use initialize_copy
instead of overriding clone/dup. [ruby-dev:40221] it now always clones the target, it might cause incompatibility. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/delegate.rb14
2 files changed, 9 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index bf27476c47..058489a49b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Jan 29 01:42:24 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/delegate.rb (Delegator#initialize_copy): use initialize_copy
+ instead of overriding clone/dup. [ruby-dev:40221]
+ it now always clones the target, it might cause incompatibility.
+
Fri Jan 29 01:26:53 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/bigdecimal/bigdecimal.c (BigDecimal_to_i): update RDoc to
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 1516dacb15..849cad58a8 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -201,17 +201,9 @@ class Delegator
end
end
- # Clone support for the object returned by \_\_getobj\_\_.
- def clone
- new = super
- new.__setobj__(__getobj__.clone)
- new
- end
- # Duplication support for the object returned by \_\_getobj\_\_.
- def dup
- new = super
- new.__setobj__(__getobj__.dup)
- new
+ # clone/dup support for the object returned by \_\_getobj\_\_.
+ def initialize_copy(other)
+ self.__setobj__(other.__getobj__.clone)
end
# Freeze self and target at once.