summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2021-12-24 14:36:45 +0900
committernagachika <nagachika@ruby-lang.org>2021-12-24 14:36:45 +0900
commit62a33dfa168504f8ee77d493979e66616ebe1da8 (patch)
tree5ad145c4b4fd27a9aa015f64b6715976db2dc435
parentbadffc7bee32251e2bea5897dc502b887e7ffa9b (diff)
merge revision(s) c6706f15af123bdbb3b39a21903d85c78462d047: [Backport #18241]
Fix documentation for String#{<<,concat,prepend} These methods mutate and return the receiver, they don't create and return a new string. Fixes [Bug #18241] --- string.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
-rw-r--r--string.c19
-rw-r--r--version.h2
2 files changed, 11 insertions, 10 deletions
diff --git a/string.c b/string.c
index 1db7acc8c8..1777125b2b 100644
--- a/string.c
+++ b/string.c
@@ -3155,13 +3155,13 @@ rb_str_concat_literals(size_t num, const VALUE *strary)
/*
* call-seq:
- * string.concat(*objects) -> new_string
+ * string.concat(*objects) -> string
*
- * Returns a new \String containing the concatenation
- * of +self+ and all objects in +objects+:
+ * Concatenates each object in +objects+ to +self+ and returns +self+:
*
* 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:
@@ -3193,12 +3193,13 @@ rb_str_concat_multi(int argc, VALUE *argv, VALUE str)
/*
* call-seq:
- * string << object -> str
+ * string << object -> string
+ *
+ * Concatenates +object+ to +self+ and returns +self+:
*
- * Returns a new \String containing the concatenation
- * of +self+ and +object+:
* s = 'foo'
* s << 'bar' # => "foobar"
+ * s # => "foobar"
*
* If +object+ is an \Integer,
* the value is considered a codepoint and converted to a character before concatenation:
@@ -3273,12 +3274,12 @@ rb_str_concat(VALUE str1, VALUE str2)
/*
* call-seq:
- * string.prepend(*other_strings) -> str
+ * string.prepend(*other_strings) -> string
*
- * Returns a new \String containing the concatenation
- * of all given +other_strings+ and +self+:
+ * Prepends each string in +other_strings+ to +self+ and returns +self+:
* s = 'foo'
* s.prepend('bar', 'baz') # => "barbazfoo"
+ * s # => "barbazfoo"
*
* Related: String#concat.
*/
diff --git a/version.h b/version.h
index 6903a7c682..e3c26230f6 100644
--- a/version.h
+++ b/version.h
@@ -12,7 +12,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 4
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 161
+#define RUBY_PATCHLEVEL 162
#define RUBY_RELEASE_YEAR 2021
#define RUBY_RELEASE_MONTH 12