[](*args)
public
Invokes the meth with the specified arguments, returning the
method’s return value.
m = 12.method("+")
m.call(3)
m.call(20)
Show source
VALUE
rb_method_call(int argc, VALUE *argv, VALUE method)
{
VALUE result = Qnil; /* OK */
struct METHOD *data;
int state;
volatile int safe = -1;
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
if (data->recv == Qundef) {
rb_raise(rb_eTypeError, "can't call unbound method; bind first");
}
PUSH_TAG();
if (OBJ_TAINTED(method)) {
safe = rb_safe_level();
if (rb_safe_level() < 4) {
rb_set_safe_level_force(4);
}
}
if ((state = EXEC_TAG()) == 0) {
rb_thread_t *th = GET_THREAD();
PASS_PASSED_BLOCK_TH(th);
result = rb_vm_call(th, data->recv, data->id, argc, argv, data->me);
}
POP_TAG();
if (safe >= 0)
rb_set_safe_level_force(safe);
if (state)
JUMP_TAG(state);
return result;
}