diff --git a/mrbgems/mruby-string-ext/src/string.c b/mrbgems/mruby-string-ext/src/string.c
index 916487260..3c3b1048d 100644
--- a/mrbgems/mruby-string-ext/src/string.c
+++ b/mrbgems/mruby-string-ext/src/string.c
@@ -146,27 +146,9 @@ mrb_str_swapcase(mrb_state *mrb, mrb_value self)
return str;
}
-/*
- * call-seq:
- * str << integer -> str
- * str.concat(integer) -> str
- * str << obj -> str
- * str.concat(obj) -> str
- *
- * Append---Concatenates the given object to str. If the object is a
- * Integer, it is considered as a codepoint, and is converted
- * to a character before concatenation
- * (equivalent to str.concat(integer.chr(__ENCODING__))).
- *
- * a = "hello "
- * a << "world" #=> "hello world"
- * a.concat(33) #=> "hello world!"
- */
-static mrb_value
-mrb_str_concat_m(mrb_state *mrb, mrb_value self)
+static void
+str_concat(mrb_state *mrb, mrb_value self, mrb_value str)
{
- mrb_value str = mrb_get_arg1(mrb);
-
if (mrb_integer_p(str) || mrb_float_p(str))
#ifdef MRB_UTF8_STRING
str = int_chr_utf8(mrb, str);
@@ -176,6 +158,39 @@ mrb_str_concat_m(mrb_state *mrb, mrb_value self)
else
mrb_ensure_string_type(mrb, str);
mrb_str_cat_str(mrb, self, str);
+}
+
+/*
+ * call-seq:
+ * str << obj -> str
+ * str.concat(*obj) -> str
+ *
+ * s = 'foo'
+ * s.concat('bar', 'baz') # => "foobarbaz"
+ * s # => "foobarbaz"
+ *
+ * For each given object +object+ that is an \Integer,
+ * the value is considered a codepoint and converted to a character before concatenation:
+ *
+ * s = 'foo'
+ * s.concat(32, 'bar', 32, 'baz') # => "foo bar baz"
+ *
+ */
+static mrb_value
+mrb_str_concat_m(mrb_state *mrb, mrb_value self)
+{
+ if (mrb_get_argc(mrb) == 1) {
+ str_concat(mrb, self, mrb_get_arg1(mrb));
+ return self;
+ }
+
+ mrb_value *args;
+ mrb_int alen;
+
+ mrb_get_args(mrb, "*", &args, &alen);
+ for (mrb_int i=0; i