From 2cfcc42a17d7de808fad5468cf93e1a79b839ab0 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 11 Dec 2001 03:48:08 +0000 Subject: * string.c (rb_str_match_m): should convert an argument into regexp if it's a string. * array.c (rb_ary_select): Array#select(n,m,...) now works like Array#indexes(n,m,..). [new, experimental] * hash.c (rb_hash_select): ditto. * hash.c (env_select): ditto. * re.c (match_select): ditto. * struct.c (rb_struct_select): ditto. * gc.c (STR_ASSOC): use FL_USER3 instead of FL_USER2. * parse.y (str_extend): make up pushback call. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'string.c') diff --git a/string.c b/string.c index f3520813a..640cf7f6d 100644 --- a/string.c +++ b/string.c @@ -812,6 +812,7 @@ static VALUE rb_str_match2(str) VALUE str; { + StringValue(str); return rb_reg_match2(rb_reg_regcomp(str)); } @@ -819,6 +820,12 @@ static VALUE rb_str_match_m(str, re) VALUE str, re; { + VALUE str2 = rb_check_convert_type(re, T_STRING, "String", "to_str"); + + if (!NIL_P(str2)) { + StringValue(re); + re = rb_reg_regcomp(re); + } return rb_funcall(re, rb_intern("match"), 1, str); } -- cgit