Class: UnboundMethod
Instance Method Summary collapse
-
#body ⇒ Object
The node that acts as body of the method.
- #unchecked_bind(recv) ⇒ Object
Instance Method Details
#body ⇒ Object
The node that acts as body of the method
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'ext/getsource_base/getsource_base.c', line 52
VALUE rb_method_body(VALUE self) {
// VALUE name = rb_funcall(self, intern_name, 0);
// VALUE sym = rb_funcall(name, intern_sym, 0);
// VALUE owner = rb_funcall(self, intern_owner, 0);
// NODE* body = rb_method_node(owner, SYM2ID(sym) );
struct METHOD* method;
Data_Get_Struct(self,struct METHOD,method);
if (method->body == 0) return Qnil;
// nd_defn is only present in ruby_1.8
if (method->body->nd_defn != 0) {
return Data_Wrap_Struct(rb_cNode, 0, 0, method->body->nd_defn);
}
return Data_Wrap_Struct(rb_cNode, 0, 0, method->body);
}
|
#unchecked_bind(recv) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'ext/getsource_base/getsource_base.c', line 107
static VALUE
umethod_unchecked_bind(VALUE method, VALUE recv)
{
struct METHOD *data, *bound;
Data_Get_Struct(method, struct METHOD, data);
method = Data_Make_Struct(rb_cMethod, struct METHOD, bm_mark, -1, bound);
*bound = *data;
bound->recv = recv;
bound->rklass = CLASS_OF(recv);
return method;
}
|