Forum: Ruby-core Ruby 1.8.7: DelegateClass#respond_to? missing second argument

Posted by Jeremy Kemper (Guest)
on 2008-06-02 09:11
(Received via mailing list)
ruby -v -rdelegate -e 'class Foo < DelegateClass(String); end;
Marshal.dump(Foo.new("abc"))'
ruby 1.8.7 (2008-05-31 patchlevel 5000) [i686-darwin9.2.2]
-e:1:in `respond_to?': wrong number of arguments (2 for 1) 
(ArgumentError)
  from -e:1:i


Index: lib/delegate.rb
===================================================================
--- lib/delegate.rb  (revision 16732)
+++ lib/delegate.rb  (working copy)
@@ -163,9 +163,9 @@
   # 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 @@
       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
Posted by Akinori MUSHA (Guest)
on 2008-06-02 09:33
(Received via mailing list)
At Mon, 2 Jun 2008 16:07:50 +0900,
Jeremy Kemper wrote:
> ruby -v -rdelegate -e 'class Foo < DelegateClass(String); end;
> Marshal.dump(Foo.new("abc"))'
> ruby 1.8.7 (2008-05-31 patchlevel 5000) [i686-darwin9.2.2]
> -e:1:in `respond_to?': wrong number of arguments (2 for 1) (ArgumentError)
>   from -e:1:i

Thanks.  Trunk and ruby_1_8 have been patched, and ruby_1_8_7 will
follow later.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.