From: Eero Saynatkari Date: 2010-01-28T03:23:18+09:00 Subject: [ruby-core:27906] Re: Ruby 1.8.7, rb_define_method and ArgumentError: wrong number of arguments (0 for 1) 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 An easy way to check, in case the problem is nonobvious, is to rename the method to #my_special_drop and try that. If it still seems there is an issue, you need to submit a reproducible example (on gist or some other pasteboard, for example) along with your uname info and the exact Ruby version. You can also hop on IRC, #ruby-lang on Freenode, for some more interactive help to confirm there is a bug (or not) so that we do not needlessly clutter the mailing list. Eero -- Magic is insufficiently advanced technology.