ruby-changes:2193
From: ko1@a...
Date: 12 Oct 2007 23:36:12 +0900
Subject: [ruby-changes:2193] matz - Ruby:r13684 (ruby_1_8): * re.c (match_values_at): make #select to be alias to #values_at
matz 2007-10-12 23:36:02 +0900 (Fri, 12 Oct 2007) New Revision: 13684 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/re.c branches/ruby_1_8/version.h Log: * re.c (match_values_at): make #select to be alias to #values_at to adapt RDoc description. [ruby-core:12588] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/re.c?r1=13684&r2=13683 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=13684&r2=13683 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.h?r1=13684&r2=13683 Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 13683) +++ ruby_1_8/ChangeLog (revision 13684) @@ -1,3 +1,8 @@ +Fri Oct 12 11:22:15 2007 Yukihiro Matsumoto <matz@r...> + + * re.c (match_values_at): make #select to be alias to #values_at + to adapt RDoc description. [ruby-core:12588] + Thu Oct 11 14:32:46 2007 NAKAMURA Usaku <usa@r...> * {bcc32,win32}/Makefile.sub (COMMON_MACROS): workaround for old SDK's Index: ruby_1_8/re.c =================================================================== --- ruby_1_8/re.c (revision 13683) +++ ruby_1_8/re.c (revision 13684) @@ -1217,14 +1217,15 @@ /* * call-seq: - * mtch.select([index]*) => array + * mtch.values_at([index]*) => array + * mtch.select([index]*) => array * * Uses each <i>index</i> to access the matching values, returning an array of * the corresponding matches. * * m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie") * m.to_a #=> ["HX1138", "H", "X", "113", "8"] - * m.select(0, 2, -2) #=> ["HX1138", "X", "113"] + * m.values_at(0, 2, -2) #=> ["HX1138", "X", "113"] */ static VALUE @@ -1237,46 +1238,7 @@ } -/* - * call-seq: - * mtch.select([index]*) => array - * - * Uses each <i>index</i> to access the matching values, returning an - * array of the corresponding matches. - * - * m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie") - * m.to_a #=> ["HX1138", "H", "X", "113", "8"] - * m.select(0, 2, -2) #=> ["HX1138", "X", "113"] - */ -static VALUE -match_select(argc, argv, match) - int argc; - VALUE *argv; - VALUE match; -{ - if (argc > 0) { - rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc); - } - else { - struct re_registers *regs = RMATCH(match)->regs; - VALUE target = RMATCH(match)->str; - VALUE result = rb_ary_new(); - int i; - int taint = OBJ_TAINTED(match); - - for (i=0; i<regs->num_regs; i++) { - VALUE str = rb_str_substr(target, regs->beg[i], regs->end[i]-regs->beg[i]); - if (taint) OBJ_TAINT(str); - if (RTEST(rb_yield(str))) { - rb_ary_push(result, str); - } - } - return result; - } -} - - /* * call-seq: * mtch.to_s => str @@ -2313,8 +2275,8 @@ rb_define_method(rb_cMatch, "to_a", match_to_a, 0); rb_define_method(rb_cMatch, "[]", match_aref, -1); rb_define_method(rb_cMatch, "captures", match_captures, 0); - rb_define_method(rb_cMatch, "select", match_select, -1); rb_define_method(rb_cMatch, "values_at", match_values_at, -1); + rb_define_method(rb_cMatch, "select", match_values_at, -1); rb_define_method(rb_cMatch, "pre_match", rb_reg_match_pre, 0); rb_define_method(rb_cMatch, "post_match", rb_reg_match_post, 0); rb_define_method(rb_cMatch, "to_s", match_to_s, 0); Index: ruby_1_8/version.h =================================================================== --- ruby_1_8/version.h (revision 13683) +++ ruby_1_8/version.h (revision 13684) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.6" -#define RUBY_RELEASE_DATE "2007-10-11" +#define RUBY_RELEASE_DATE "2007-10-12" #define RUBY_VERSION_CODE 186 -#define RUBY_RELEASE_CODE 20071011 +#define RUBY_RELEASE_CODE 20071012 #define RUBY_PATCHLEVEL 5000 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 6 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 11 +#define RUBY_RELEASE_DAY 12 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml