summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.