summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-30 15:22:00 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-30 15:22:00 +0000
commitc018c992da9409a27181311cb7633eb3662bb9fc (patch)
treed6cd871ede12047087d31ace6722cfbdf8183f70
parent1a6b5e7a1893736b1d3151441b570f903a9f1536 (diff)
* lib/delegate.rb (Delegator::respond_to): respond_to? must check
destination object. [ruby-talk:146894] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/delegate.rb9
2 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index bb014da..26f90de 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 97467cd..ca1f028 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