mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/delegate.rb (DelegateClass, Delegator#respond_to?):
respond_to? should now take optional second argument; submitted by Jeremy Kemper <jeremy at bitsweat.net> in [ruby-core:17045]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6b16264865
commit
1e19dedba5
2 changed files with 10 additions and 4 deletions
|
@ -163,9 +163,9 @@ class Delegator
|
|||
# Checks for a method provided by this the delegate object by fowarding the
|
||||
# call through \_\_getobj\_\_.
|
||||
#
|
||||
def respond_to?(m)
|
||||
def respond_to?(m, include_private = false)
|
||||
return true if super
|
||||
return self.__getobj__.respond_to?(m)
|
||||
return self.__getobj__.respond_to?(m, include_private)
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -270,9 +270,9 @@ def DelegateClass(superclass)
|
|||
end
|
||||
@_dc_obj.__send__(m, *args)
|
||||
end
|
||||
def respond_to?(m) # :nodoc:
|
||||
def respond_to?(m, include_private = false) # :nodoc:
|
||||
return true if super
|
||||
return @_dc_obj.respond_to?(m)
|
||||
return @_dc_obj.respond_to?(m, include_private)
|
||||
end
|
||||
def __getobj__ # :nodoc:
|
||||
@_dc_obj
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue