diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-05-24 04:34:26 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-05-24 04:34:26 +0000 |
commit | 8b1de0b1ad49733abeddd8be359ae816b29de59a (patch) | |
tree | a7ed03dd3f6442635f694c4367bcd94be57f6dbd /object.c | |
parent | 24b9bdca25dc431aff935df7739b9c5ea0ee4077 (diff) |
2000-05-24
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -159,9 +159,8 @@ inspect_i(id, value, str) /* need not to show internal data */ if (CLASS_OF(value) == 0) return ST_CONTINUE; if (!rb_is_instance_id(id)) return ST_CONTINUE; - if (RSTRING(str)->ptr[0] == '-') { + if (RSTRING(str)->ptr[0] == '-') { /* first element */ RSTRING(str)->ptr[0] = '#'; - rb_str_cat2(str, ": "); } else { rb_str_cat2(str, ", "); @@ -195,16 +194,17 @@ rb_obj_inspect(obj) && ROBJECT(obj)->iv_tbl && ROBJECT(obj)->iv_tbl->num_entries > 0) { VALUE str; - char *b; + char *c, *b; - b = rb_class2name(CLASS_OF(obj)); + c = rb_class2name(CLASS_OF(obj)); if (rb_inspecting_p(obj)) { - char *buf = ALLOCA_N(char, strlen(b)+8); - sprintf(buf, "#<%s:...>", b); - return rb_str_new2(buf); + b = ALLOCA_N(char, strlen(c)+8+16+1); /* 8:tags 16:addr 1:eos */ + sprintf(b, "#<%s:0x%lx ...>", c, obj); + return rb_str_new2(b); } - str = rb_str_new2("-<"); - rb_str_cat2(str, b); + b = ALLOCA_N(char, strlen(c)+4+16+1); /* 4:tags 16:addr 1:eos */ + sprintf(b, "-<%s:0x%lx ", c, obj); + str = rb_str_new2(b); return rb_protect_inspect(inspect_obj, obj, str); } return rb_funcall(obj, rb_intern("to_s"), 0, 0); @@ -630,6 +630,7 @@ rb_module_s_new(klass) VALUE mod = rb_module_new(); RBASIC(mod)->klass = klass; + rb_obj_call_init(klass, 0, 0); return mod; } @@ -651,6 +652,7 @@ rb_class_s_new(argc, argv) /* make metaclass */ RBASIC(klass)->klass = rb_singleton_class_new(RBASIC(super)->klass); rb_singleton_class_attached(RBASIC(klass)->klass, klass); + rb_obj_call_init(klass, argc, argv); rb_funcall(super, rb_intern("inherited"), 1, klass); return klass; @@ -1086,7 +1088,7 @@ Init_Object() rb_define_method(rb_mKernel, "private_methods", rb_obj_private_methods, 0); rb_define_method(rb_mKernel, "instance_variables", rb_obj_instance_variables, 0); rb_define_private_method(rb_mKernel, "remove_instance_variable", - rb_obj_remove_instance_variable, 0); + rb_obj_remove_instance_variable, 1); rb_define_method(rb_mKernel, "instance_of?", rb_obj_is_instance_of, 1); rb_define_method(rb_mKernel, "kind_of?", rb_obj_is_kind_of, 1); |