unbind()
public
Dissociates meth from it’s current receiver. The resulting
UnboundMethod can subsequently
be bound to a new object of the same class (see UnboundMethod).
Show source
/*
* call-seq:
* meth.unbind => unbound_method
*
* Dissociates <i>meth</i> from it's current receiver. The resulting
* <code>UnboundMethod</code> can subsequently be bound to a new object
* of the same class (see <code>UnboundMethod</code>).
*/
static VALUE
method_unbind(obj)
VALUE obj;
{
VALUE method;
struct METHOD *orig, *data;
Data_Get_Struct(obj, struct METHOD, orig);
method = Data_Make_Struct(rb_cUnboundMethod, struct METHOD, bm_mark, free, data);
data->klass = orig->klass;
data->recv = Qundef;
data->id = orig->id;
data->body = orig->body;
data->rklass = orig->rklass;
data->oid = orig->oid;
OBJ_INFECT(method, obj);
return method;
}