Feature #4254 ยป 0001-method-transplanting-Allow-to-set-an-UnboundMethod-t.patch
proc.c | ||
---|---|---|
if (rb_obj_is_method(body)) {
|
||
struct METHOD *method = (struct METHOD *)DATA_PTR(body);
|
||
VALUE rclass = method->rclass;
|
||
if (rclass != mod && !RTEST(rb_class_inherited_p(mod, rclass))) {
|
||
if (FL_TEST(rclass, FL_SINGLETON)) {
|
||
rb_raise(rb_eTypeError,
|
||
"can't bind singleton method to a different class");
|
||
}
|
||
else {
|
||
rb_raise(rb_eTypeError,
|
||
"bind argument must be a subclass of %s",
|
||
rb_class2name(rclass));
|
||
}
|
||
}
|
||
rb_method_entry_set(mod, id, &method->me, noex);
|
||
}
|
||
else if (rb_obj_is_proc(body)) {
|