new(...)
public
Creates a new Proc object, bound to the current context.
Proc::new may be called without a block only within a method with
an attached block, in which case that block is converted to the Proc object.
def proc_from
Proc.new
end
proc = proc_from { "hello" }
proc.call
Show source
/*
* call-seq:
* Proc.new {|...| block } => a_proc
* Proc.new => a_proc
*
* Creates a new <code>Proc</code> object, bound to the current
* context. <code>Proc::new</code> may be called without a block only
* within a method with an attached block, in which case that block is
* converted to the <code>Proc</code> object.
*
* def proc_from
* Proc.new
* end
* proc = proc_from { "hello" }
* proc.call
*/
static VALUE
proc_s_new(argc, argv, klass)
int argc;
VALUE *argv;
VALUE klass;
{
VALUE block = proc_alloc(klass, Qfalse);
rb_obj_call_init(block, argc, argv);
return block;
}