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

* string.c (sym_encoding): return the encoding of a Symbol.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-08-27 06:56:49 +00:00
parent d4b9e9815b
commit 3ca07d8718
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Mon Aug 27 15:56:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (sym_encoding): return the encoding of a Symbol.
Mon Aug 27 15:33:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* util.c (IEEE_BIG_ENDIAN): use configured value. [ruby-dev:31623]

View file

@ -5171,6 +5171,12 @@ sym_swapcase(VALUE sym)
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 @@ Init_String(void)
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);
}