[Ruby] splatting arguments in a C extension

John Barnette jbarnette at gmail.com
Fri Feb 1 23:08:04 PST 2008


On Feb 1, 2008 9:14 PM, Aaron Patterson <aaron at tenderlovemaking.com> wrote:
> I'm writing a C extension, and I've got an array that I need to pass to
> a function.  I need to splat the array that goes to the function though.
> Anyone know how to do this?  I couldn't find much help in the docs.....

If you pass -2 as argc in rb_define_method, the function will behave
as splatted: it'll get self and *args as arguments.


~ j.


More information about the Ruby mailing list