summaryrefslogtreecommitdiff
path: root/lib/delegate.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/delegate.rb')
-rw-r--r--lib/delegate.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 205d5e1fbda..a5447739836 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -13,11 +13,12 @@
class Delegator
def initialize(obj)
- preserved = ["type", "id", "equal?", "__getobj__"]
for t in self.type.ancestors
preserved |= t.instance_methods
break if t == Delegator
end
+ preserved |= ::Kernel.instance_methods
+ preserved -= ["to_s", "nil?", "to_a", "hash", "dup", "==", "=~"]
for method in obj.methods
next if preserved.include? method
eval "def self.#{method}(*args,&block); __getobj__.__send__(:#{method}, *args,&block); end"