0001-method-transplanting-Allow-to-set-an-UnboundMethod-t.patch

zimba tm, 01/09/2011 09:58 PM

Download (1.07 KB)

View differences:

proc.c
1293 1293
    if (rb_obj_is_method(body)) {
1294 1294
	struct METHOD *method = (struct METHOD *)DATA_PTR(body);
1295 1295
	VALUE rclass = method->rclass;
1296
	if (rclass != mod && !RTEST(rb_class_inherited_p(mod, rclass))) {
1297
	    if (FL_TEST(rclass, FL_SINGLETON)) {
1298
		rb_raise(rb_eTypeError,
1299
			 "can't bind singleton method to a different class");
1300
	    }
1301
	    else {
1302
		rb_raise(rb_eTypeError,
1303
			 "bind argument must be a subclass of %s",
1304
			 rb_class2name(rclass));
1305
	    }
1306
	}
1307 1296
	rb_method_entry_set(mod, id, &method->me, noex);
1308 1297
    }
1309 1298
    else if (rb_obj_is_proc(body)) {
1310
-