summaryrefslogtreecommitdiff
path: root/ext/-test-/string/enc_associate.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-15 07:55:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-15 07:55:08 +0000
commit28c42b4c25c48f65cd559018678a5cf34d387c24 (patch)
tree4c83920b97ecad2a938abff5e3844d590aab4b49 /ext/-test-/string/enc_associate.c
parente262b29ed00fc09f64bd809d84233bdc56d21bab (diff)
encoding.c: drop dummy encoding flag
* encoding.c (enc_autoload): drop dummy encoding flag from the loaded encoding index. this flag is used only in this source. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/-test-/string/enc_associate.c')
-rw-r--r--ext/-test-/string/enc_associate.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/-test-/string/enc_associate.c b/ext/-test-/string/enc_associate.c
index d6614fb298..53811620a0 100644
--- a/ext/-test-/string/enc_associate.c
+++ b/ext/-test-/string/enc_associate.c
@@ -7,8 +7,16 @@ bug_str_enc_associate(VALUE str, VALUE enc)
return rb_enc_associate(str, rb_to_encoding(enc));
}
+VALUE
+bug_str_encoding_index(VALUE self, VALUE str)
+{
+ int idx = rb_enc_get_index(str);
+ return INT2NUM(idx);
+}
+
void
Init_enc_associate(VALUE klass)
{
rb_define_method(klass, "associate_encoding!", bug_str_enc_associate, 1);
+ rb_define_singleton_method(klass, "encoding_index", bug_str_encoding_index, 1);
}