Method: UnboundMethod#bind_call
- Defined in:
- proc.c
#bind_call(recv, args, ...) ⇒ Object
Bind umeth to recv and then invokes the method with the specified arguments. This is semantically equivalent to umeth.bind(recv).call(args, ...)
.
2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 |
# File 'proc.c', line 2601
static VALUE
umethod_bind_call(int argc, VALUE *argv, VALUE method)
{
rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
VALUE recv = argv[0];
argc--;
argv++;
VALUE methclass, klass, iclass;
const rb_method_entry_t *me;
convert_umethod_to_method_components(method, recv, &methclass, &klass, &iclass, &me);
struct METHOD bound = { recv, klass, 0, me };
VALUE passed_procval = rb_block_given_p() ? rb_block_proc() : Qnil;
rb_execution_context_t *ec = GET_EC();
return call_method_data(ec, &bound, argc, argv, passed_procval, RB_PASS_CALLED_KEYWORDS);
}
|