summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-27 06:56:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-27 06:56:49 +0000
commit84820319789e6ba191ace5744c2e14be1a5f274e (patch)
tree5c6ffccbe9beb8c417d87e88a6ca3f19b44d2824 /string.c
parenteda3c69245e41d1c71b5dd1ff92fadfb08f9c3fc (diff)
downloadruby-84820319789e6ba191ace5744c2e14be1a5f274e.tar.gz
ruby-84820319789e6ba191ace5744c2e14be1a5f274e.tar.xz
ruby-84820319789e6ba191ace5744c2e14be1a5f274e.zip
* string.c (sym_encoding): return the encoding of a Symbol.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/string.c b/string.c
index 11c80d461..653f4c067 100644
--- a/string.c
+++ b/string.c
@@ -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);
}