1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* class.c (rb_mod_init_copy): always copy singleton class.

[ruby-dev:22325]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-12-22 12:15:34 +00:00
parent 88695fc0ea
commit 65fed5dad3
3 changed files with 10 additions and 1 deletions

View file

@ -1,8 +1,13 @@
Mon Dec 22 21:15:29 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* class.c (rb_mod_init_copy): always copy singleton class.
[ruby-dev:22325]
Mon Dec 22 20:44:36 2003 akira yamada <akira@ruby-lang.org> Mon Dec 22 20:44:36 2003 akira yamada <akira@ruby-lang.org>
* lib/uri/generic.rb (URI::Generic#route_from): accepts urls which * lib/uri/generic.rb (URI::Generic#route_from): accepts urls which
has no host-part. has no host-part.
* test/uri/test_generic.rb (TestGeneric::test_route): added a test. * test/uri/test_generic.rb (TestGeneric::test_route): added a test.
Mon Dec 22 20:38:44 2003 Nobuyoshi Nakada <nobu@ruby-lang.org> Mon Dec 22 20:38:44 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>

View file

@ -63,6 +63,9 @@ rb_mod_init_copy(clone, orig)
VALUE clone, orig; VALUE clone, orig;
{ {
rb_obj_init_copy(clone, orig); rb_obj_init_copy(clone, orig);
if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
RBASIC(clone)->klass = rb_singleton_class_clone(orig);
}
RCLASS(clone)->super = RCLASS(orig)->super; RCLASS(clone)->super = RCLASS(orig)->super;
if (RCLASS(orig)->iv_tbl) { if (RCLASS(orig)->iv_tbl) {
ID id; ID id;

View file

@ -1662,6 +1662,7 @@ Init_Object()
rb_define_method(rb_cClass, "allocate", rb_obj_alloc, 0); rb_define_method(rb_cClass, "allocate", rb_obj_alloc, 0);
rb_define_method(rb_cClass, "new", rb_class_new_instance, -1); rb_define_method(rb_cClass, "new", rb_class_new_instance, -1);
rb_define_method(rb_cClass, "initialize", rb_class_initialize, -1); rb_define_method(rb_cClass, "initialize", rb_class_initialize, -1);
rb_define_method(rb_cClass, "initialize_copy", rb_class_init_copy, 1);
rb_define_method(rb_cClass, "superclass", rb_class_superclass, 0); rb_define_method(rb_cClass, "superclass", rb_class_superclass, 0);
rb_define_alloc_func(rb_cClass, rb_class_s_alloc); rb_define_alloc_func(rb_cClass, rb_class_s_alloc);
rb_undef_method(rb_cClass, "extend_object"); rb_undef_method(rb_cClass, "extend_object");