summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-08 06:25:19 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-08 06:25:19 +0000
commit035226e1fe71085c7c9c84dacd14448870fca9da (patch)
tree5e20e8c2bdc5ed8f899ec55446e81f040a522ead /object.c
parent4d215cd9d3e0c4ea8ba802aa87773d6578c45a15 (diff)
2000-03-08
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/object.c b/object.c
index 72429641e1..8ece5babe5 100644
--- a/object.c
+++ b/object.c
@@ -497,7 +497,13 @@ static VALUE
sym_to_s(sym)
VALUE sym;
{
- return rb_str_new2(rb_id2name(SYM2ID(sym)));
+ char *name, *buf;
+
+ name = rb_id2name(SYM2ID(sym));
+ buf = ALLOCA_N(char, strlen(name)+2);
+ sprintf(buf, ":%s", name);
+
+ return rb_str_new2(buf);
}
static VALUE
@@ -1100,7 +1106,7 @@ Init_Object()
rb_define_global_const("NIL", Qnil);
rb_cSymbol = rb_define_class("Symbol", rb_cObject);
- rb_undef_method(CLASS_OF(rb_cNilClass), "new");
+ rb_undef_method(CLASS_OF(rb_cSymbol), "new");
rb_define_method(rb_cSymbol, "type", sym_type, 0);
rb_define_method(rb_cSymbol, "to_i", sym_to_i, 0);
rb_define_method(rb_cSymbol, "to_s", sym_to_s, 0);