From: "Gerardo Santana Gómez Garrido" Date: 2010-01-28T03:33:21+09:00 Subject: [ruby-core:27908] Re: Ruby 1.8.7, rb_define_method and ArgumentError: wrong number of arguments (0 for 1) On Wed, Jan 27, 2010 at 12:23 PM, Eero Saynatkari wrote: > On 1/27/10 9:31 AM, "Gerardo Santana G�mez Garrido" > wrote: >>>> I have the following method defined in a C extension: >>>> >>>> � � rb_define_method(rb_cCursorBase, "drop", rb_cursorbase_drop, 0); >>>> >>>> ArgumentError: wrong number of arguments (0 for 1) >>> >>> I think 1.8.7 defines both Array#drop and Enumerable#drop. >>> Might it be the case that you are calling one of these by >>> Accident instead? >> >> I'm sure I'm calling Cursor#drop, where Cursor is a class defined in >> such C extension. > > There is no reason why it should not work. The 0 does indeed > mark it as taking no arguments and I cannot imagine that it > would not be working correctly. That means you are almost > certainly doing something like: > > � �class Cursor < CursorBase > � � �include Enumerable > � �end > > � �Cursor.new.drop � � �# Calls Enumerable#drop Yes. That's it :) I'm including Enumerable exactly as you say. Thanks a lot Eero. How can I make Cursor#drop prevail over Enumerable's? -- Gerardo Santana