diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-26 02:00:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-26 02:00:56 +0000 |
commit | b3edab35cac19a5dca91297e8f1d452d49c3ce14 (patch) | |
tree | 660c604d59ab9c5a8c3640a83567354758f7b604 /ext/-test-/string/cstr.c | |
parent | 5fb4f81eecc03b418067f6e8bf24e97b774eb968 (diff) | |
download | ruby-b3edab35cac19a5dca91297e8f1d452d49c3ce14.tar.gz |
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/-test-/string/cstr.c')
-rw-r--r-- | ext/-test-/string/cstr.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/-test-/string/cstr.c b/ext/-test-/string/cstr.c index 50214bb008..81edbb0b79 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); } |