예제 #1
0
static VALUE
rsym_to_proc(VALUE sym, SEL sel)
{
    ID mid = SYM2ID(sym);
    rb_vm_block_t *b = rb_vm_create_block_calling_mid(mid);
    return rb_proc_alloc_with_block(rb_cProc, b);
}
예제 #2
0
파일: proc.c 프로젝트: MSch/MacRuby
static VALUE
method_proc(VALUE method, SEL sel)
{
    rb_vm_method_t *data;
    Data_Get_Struct(method, rb_vm_method_t, data);
    rb_vm_block_t *block = rb_vm_create_block_from_method(data);
    return rb_proc_alloc_with_block(rb_cProc, block);
}
예제 #3
0
파일: proc.c 프로젝트: MSch/MacRuby
static VALUE
proc_new(VALUE klass, bool is_lambda)
{
    rb_vm_block_t *block = rb_vm_first_block();
    if (block == NULL) {
	rb_raise(rb_eArgError,
		"tried to create Proc object without a block");
    }
    if (is_lambda) {
	block->flags |= VM_BLOCK_LAMBDA;
    }
    return rb_proc_alloc_with_block(klass, block);
}