mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/delegate.rb (Delegator#respond_to_missing): warn only when
specified method is a private. [ruby-dev:39498] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b73be705db
commit
c02e47c4e0
2 changed files with 10 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Oct 17 08:51:44 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/delegate.rb (Delegator#respond_to_missing): warn only when
|
||||
specified method is a private. [ruby-dev:39498]
|
||||
|
||||
Fri Oct 17 00:05:53 2009 wanabe <s.wanabe@gmail.com>
|
||||
|
||||
* st.c (unpack_entries): save table->bins and never change the table
|
||||
|
|
|
@ -149,10 +149,12 @@ class Delegator
|
|||
# call through \_\_getobj\_\_.
|
||||
#
|
||||
def respond_to_missing?(m, include_private = false)
|
||||
if include_private
|
||||
warn "#{caller(3)[0]}: delegator does not forward private methods"
|
||||
r = self.__getobj__.respond_to?(m, include_private)
|
||||
if r && include_private && !self.__getobj__.respond_to?(m, false)
|
||||
warn "#{caller(3)[0]}: delegator does not forward private method \##{m}"
|
||||
return false
|
||||
end
|
||||
self.__getobj__.respond_to?(m)
|
||||
r
|
||||
end
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue