diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-27 06:56:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-27 06:56:49 +0000 |
commit | 3ca07d8718a156d2dcc3691bfdd5a0fecfc276d7 (patch) | |
tree | 5c6ffccbe9beb8c417d87e88a6ca3f19b44d2824 | |
parent | d4b9e9815babe982cd66852945d72e96297cac1c (diff) | |
download | ruby-3ca07d8718a156d2dcc3691bfdd5a0fecfc276d7.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | string.c | 8 |
2 files changed, 11 insertions, 1 deletions
@@ -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] @@ -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); } |