ruby-changes:14617
From: matz <ko1@a...>
Date: Fri, 29 Jan 2010 01:49:47 +0900 (JST)
Subject: [ruby-changes:14617] Ruby:r26462 (trunk): * lib/delegate.rb (Delegator#initialize_copy): use initialize_copy
matz 2010-01-29 01:47:21 +0900 (Fri, 29 Jan 2010) New Revision: 26462 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26462 Log: * 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. Modified files: trunk/ChangeLog trunk/lib/delegate.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 26461) +++ ChangeLog (revision 26462) @@ -1,3 +1,9 @@ +Fri Jan 29 01:42:24 2010 Yukihiro Matsumoto <matz@r...> + + * 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@r...> * ext/bigdecimal/bigdecimal.c (BigDecimal_to_i): update RDoc to Index: lib/delegate.rb =================================================================== --- lib/delegate.rb (revision 26461) +++ lib/delegate.rb (revision 26462) @@ -201,18 +201,10 @@ end end - # Clone support for the object returned by \_\_getobj\_\_. - def clone - new = super - new.__setobj__(__getobj__.clone) - new + # clone/dup support for the object returned by \_\_getobj\_\_. + def initialize_copy(other) + self.__setobj__(other.__getobj__.clone) end - # Duplication support for the object returned by \_\_getobj\_\_. - def dup - new = super - new.__setobj__(__getobj__.dup) - new - end # Freeze self and target at once. def freeze -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/