summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-26 02:00:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-26 02:00:56 +0000
commitb3edab35cac19a5dca91297e8f1d452d49c3ce14 (patch)
tree660c604d59ab9c5a8c3640a83567354758f7b604 /ext
parent5fb4f81eecc03b418067f6e8bf24e97b774eb968 (diff)
cstr.c: cstr_term_char class method
* ext/-test-/string/cstr.c (bug_str_s_cstr_term_char): add a class method to see plain Strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/-test-/string/cstr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/-test-/string/cstr.c b/ext/-test-/string/cstr.c
index 50214bb..81edbb0 100644
--- a/ext/-test-/string/cstr.c
+++ b/ext/-test-/string/cstr.c
@@ -40,9 +40,17 @@ bug_str_cstr_term_char(VALUE str)
return c ? rb_enc_uint_chr((unsigned int)c, enc) : Qnil;
}
+static VALUE
+bug_str_s_cstr_term_char(VALUE self, VALUE str)
+{
+ Check_Type(str, T_STRING);
+ return bug_str_cstr_term_char(str);
+}
+
void
Init_cstr(VALUE klass)
{
rb_define_method(klass, "cstr_term", bug_str_cstr_term, 0);
rb_define_method(klass, "cstr_term_char", bug_str_cstr_term_char, 0);
+ rb_define_singleton_method(klass, "cstr_term_char", bug_str_s_cstr_term_char, 1);
}