1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
matz 2005-06-30 15:22:00 +00:00
parent 1a6b5e7a18
commit c018c992da
2 changed files with 14 additions and 0 deletions

View file

@ -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.

View file

@ -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