ruby-changes:1792
From: ko1@a...
Date: 27 Aug 2007 15:57:01 +0900
Subject: [ruby-changes:1792] nobu - Ruby:r13283 (trunk): * string.c (sym_encoding): return the encoding of a Symbol.
nobu 2007-08-27 15:56:49 +0900 (Mon, 27 Aug 2007) New Revision: 13283 Modified files: trunk/ChangeLog trunk/string.c Log: * string.c (sym_encoding): return the encoding of a Symbol. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=13283&r2=13282 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13283&r2=13282 Index: ChangeLog =================================================================== --- ChangeLog (revision 13282) +++ ChangeLog (revision 13283) @@ -1,3 +1,7 @@ +Mon Aug 27 15:56:48 2007 Nobuyoshi Nakada <nobu@r...> + + * string.c (sym_encoding): return the encoding of a Symbol. + Mon Aug 27 15:33:10 2007 Nobuyoshi Nakada <nobu@r...> * util.c (IEEE_BIG_ENDIAN): use configured value. [ruby-dev:31623] Index: string.c =================================================================== --- string.c (revision 13282) +++ string.c (revision 13283) @@ -5171,6 +5171,12 @@ return rb_str_intern(rb_str_swapcase(rb_id2str(SYM2ID(sym)))); } +static VALUE +sym_encoding(VALUE sym) +{ + return str_encoding(rb_id2str(SYM2ID(sym))); +} + ID rb_to_id(VALUE name) { @@ -5367,5 +5373,5 @@ rb_define_method(rb_cSymbol, "capitalize", sym_capitalize, 0); rb_define_method(rb_cSymbol, "swapcase", sym_swapcase, 0); - rb_define_method(rb_cSymbol, "encoding", str_encoding, 0); + rb_define_method(rb_cSymbol, "encoding", sym_encoding, 0); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml