summaryrefslogtreecommitdiffstats
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
commit709f2b9ab78c52a1bdb38be39439ea61e7c34c38 (patch)
tree5e20e8c2bdc5ed8f899ec55446e81f040a522ead /object.c
parentf0f206d828e37bf452f53fe63f729d16b42df2c9 (diff)
downloadruby-709f2b9ab78c52a1bdb38be39439ea61e7c34c38.tar.gz
ruby-709f2b9ab78c52a1bdb38be39439ea61e7c34c38.tar.xz
ruby-709f2b9ab78c52a1bdb38be39439ea61e7c34c38.zip
2000-03-08
git-svn-id: http://svn.ruby-lang.org/repos/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 72429641e..8ece5babe 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);