static VALUE rb_obj_define_method(int argc, VALUE *argv, VALUE obj) { VALUE klass = rb_singleton_class(obj); return rb_mod_define_method(argc, argv, klass); }
static VALUE rb_obj_define_method(VALUE obj, SEL sel, int argc, VALUE *argv) { VALUE klass = rb_singleton_class(obj); return rb_mod_define_method(klass, 0, argc, argv); }
static VALUE rb_mod_objc_ib_action(VALUE recv, VALUE sym) { rb_warn("ib_action has been deprecated, please define methods with only one argument instead. If you want IB support, the argument must be named 'sender' to appear in IB."); if (rb_block_given_p()) return rb_mod_define_method(1, &sym, recv); return recv; }
void rb_define_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS), int argc) { VALUE vmethod, v[2] = {value_buf_string, dummy_proc}; struct METHOD *method; set_buf_string(name); rb_mod_define_method(2, v, klass); vmethod = rb_mod_instance_method(klass, value_buf_string); method = (struct METHOD*)RTYPEDDATA_DATA(vmethod); method->me.def->type = VM_METHOD_TYPE_CFUNC; method->me.def->body.cfunc.func = func; method->me.def->body.cfunc.argc = argc; rb_mod_public(1, &value_buf_string, klass); }