summaryrefslogtreecommitdiffstats
path: root/lib/delegate.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/delegate.rb')
-rw-r--r--lib/delegate.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/delegate.rb b/lib/delegate.rb
index deffcaf0f..2a30bc94b 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -73,6 +73,7 @@ class SimpleDelegator<Delegator
end
def __setobj__(obj)
+ raise ArgumentError, "cannot delegate to self" if self.equal?(obj)
@_sd_obj = obj
end
@@ -110,6 +111,7 @@ def DelegateClass(superclass)
@_dc_obj
end
def __setobj__(obj)
+ raise ArgumentError, "cannot delegate to self" if self.equal?(obj)
@_dc_obj = obj
end
def clone