summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/delegate.rb9
2 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index bb014da4c13..26f90de3cba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul 1 00:18:40 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/delegate.rb (Delegator::respond_to): respond_to? must check
+ destination object. [ruby-talk:146894]
+
Thu Jun 30 19:00:21 2005 Keiju Ishitsuka <keiju@ruby-lang.org>
* lib/irb/ruby-lex.rb (RubyLex::identify_number): alternative implements
for [ruby-dev:26410]. And support a numeric form of 0d99999.
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 97467cd4354..ca1f0282681 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -57,6 +57,11 @@ class Delegator
target.__send__(m, *args)
end
+ def respond_to?(m)
+ return true if super
+ return self.__getobj__.respond_to?(m)
+ end
+
def __getobj__
raise NotImplementedError, "need to define `__getobj__'"
end
@@ -115,6 +120,10 @@ def DelegateClass(superclass)
end
@_dc_obj.__send__(m, *args)
end
+ def respond_to?(m)
+ return true if super
+ return @_dc_obj.respond_to?(m)
+ end
def __getobj__
@_dc_obj
end