[前][次][番号順一覧][スレッド一覧]

ruby-changes:37322

From: nobu <ko1@a...>
Date: Mon, 26 Jan 2015 11:01:04 +0900 (JST)
Subject: [ruby-changes:37322] nobu:r49403 (trunk): cstr.c: cstr_term_char class method

nobu	2015-01-26 11:00:56 +0900 (Mon, 26 Jan 2015)

  New Revision: 49403

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49403

  Log:
    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.

  Modified files:
    trunk/ext/-test-/string/cstr.c
Index: ext/-test-/string/cstr.c
===================================================================
--- ext/-test-/string/cstr.c	(revision 49402)
+++ ext/-test-/string/cstr.c	(revision 49403)
@@ -40,9 +40,17 @@ bug_str_cstr_term_char(VALUE str) https://github.com/ruby/ruby/blob/trunk/ext/-test-/string/cstr.c#L40
     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);
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]