Check -1 arity for C++

This commit is contained in:
Nobuyoshi Nakada 2019-11-22 18:39:39 +09:00
parent f9d20a1bf1
commit a93d0a4e62
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
4 changed files with 24 additions and 6 deletions

View file

@ -0,0 +1,13 @@
#include <ruby/ruby.h>
static VALUE
func_argm1(int argc, VALUE *argv, VALUE self)
{
return argc > 0 ? argv[0] : Qnil;
}
extern "C" void
Init_failure(void)
{
rb_define_method(rb_cObject, "argm1", func_argm1, 0);
}