Method: Proc#===

Defined in:
proc.c

#===(obj) ⇒ Object

Invokes the block, with obj as the block's parameter. It is to allow a proc object to be a target of when clause in the case statement.



# File 'proc.c'

/*
 *  call-seq:
 *     prc === obj   -> result_of_proc
 *
 *  Invokes the block, with <i>obj</i> as the block's parameter.  It is
 *  to allow a proc object to be a target of +when+ clause in the case statement.
 */

static VALUE
proc_call(int argc, VALUE *argv, VALUE procval)
{
    rb_proc_t *proc;
    rb_block_t *blockptr = 0;
    rb_iseq_t *iseq;
    GetProcPtr(procval, proc);

    iseq = proc->block.iseq;
    if (BUILTIN_TYPE(iseq) == T_NODE || iseq->arg_block != -1) {
    if (rb_block_given_p()) {
        rb_proc_t *proc;
        VALUE procval;
        procval = rb_block_proc();
        GetProcPtr(procval, proc);
        blockptr = &proc->block;
    }
    }

    return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
                 argc, argv, blockptr);
}