diff --git a/ChangeLog b/ChangeLog index 128f292c7a..41ca7b8648 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Oct 17 08:51:44 2009 Yukihiro Matsumoto + + * 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 * st.c (unpack_entries): save table->bins and never change the table diff --git a/lib/delegate.rb b/lib/delegate.rb index 5d256323dd..6bee43293e 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -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 #