Class: UnboundProc

Inherits:
Proc show all
Defined in:
ext/internal/proc/proc.c

Instance Method Summary collapse

Methods inherited from Proc

#<<, #_dump, _load, #argument_info, #arguments, #as_code, #as_expression, #body, #has_rest_arg, #push, #signature, #unbind, #var

Instance Method Details

#callraises TypeError

Raises a TypeError; UnboundProc objects cannot be called.

Returns:

  • (raises TypeError)


292
293
294
295
# File 'ext/internal/proc/proc.c', line 292

static VALUE unboundproc_call(VALUE self, VALUE args)
{
  rb_raise(rb_eTypeError, "you cannot call unbound proc; bind first");
}

#bind(Binding) ⇒ Proc

Bind an UnboundProc to a Binding. Returns a Proc that has been bound to the given binding.

Returns:



272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'ext/internal/proc/proc.c', line 272

static VALUE unboundproc_bind(VALUE self, VALUE binding)
{
#ifdef RUBY_VM
  rb_proc_t * p;
  GetProcPtr(self, p);
  return create_proc(rb_cProc, binding, p->block.iseq);
#else
  struct BLOCK * b;
  Data_Get_Struct(self, struct BLOCK, b);
  /* create_proc will do a security check */
  return create_proc(rb_cProc, binding, b->body, b->var);
#endif
}

#bindingraises TypeError

Raises a TypeError; UnboundProc objects have no binding.

Returns:

  • (raises TypeError)


303
304
305
306
# File 'ext/internal/proc/proc.c', line 303

static VALUE unboundproc_binding(VALUE self)
{
  rb_raise(rb_eTypeError, "unbound proc has no binding");
}

#callraises TypeError

Raises a TypeError; UnboundProc objects cannot be called.

Returns:

  • (raises TypeError)


292
293
294
295
# File 'ext/internal/proc/proc.c', line 292

static VALUE unboundproc_call(VALUE self, VALUE args)
{
  rb_raise(rb_eTypeError, "you cannot call unbound proc; bind first");
}