summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/string.c b/string.c
index f3520813a0..640cf7f6de 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);
}