diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-15 13:48:40 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-15 13:48:40 +0000 |
commit | d6bc37f276dabd2026b9c12a66b606d7cf75d27d (patch) | |
tree | a71ab5b2295895079877fb1c4c21e9ea41cce6b8 /lib | |
parent | 8bc157cbb09bc07347379617915304a7f1c18e77 (diff) | |
download | ruby-d6bc37f276dabd2026b9c12a66b606d7cf75d27d.tar.gz |
merge revision(s) 16369:
* lib/delegate.rb (SimpleDelegator::dup): removed needless argument.
[ruby-list:44910]
* lib/delegate.rb (clone, dup): keep relationship with the target
object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@17286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/delegate.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/delegate.rb b/lib/delegate.rb index d810ccad42..ea5ef2b2ae 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -228,13 +228,15 @@ class SimpleDelegator<Delegator # Clone support for the object returned by \_\_getobj\_\_. def clone - super - __setobj__(__getobj__.clone) + new = super + new.__setobj__(__getobj__.clone) + new end # Duplication support for the object returned by \_\_getobj\_\_. - def dup(obj) - super - __setobj__(__getobj__.dup) + def dup + new = super + new.__setobj__(__getobj__.clone) + new end end @@ -281,12 +283,14 @@ def DelegateClass(superclass) @_dc_obj = obj end def clone # :nodoc: - super - __setobj__(__getobj__.clone) + new = super + new.__setobj__(__getobj__.clone) + new end def dup # :nodoc: - super - __setobj__(__getobj__.dup) + new = super + new.__setobj__(__getobj__.clone) + new end } for method in methods |