ruby-changes:70519
From: nagachika <ko1@a...>
Date: Fri, 24 Dec 2021 15:04:49 +0900 (JST)
Subject: [ruby-changes:70519] 62a33dfa16 (ruby_3_0): merge revision(s) c6706f15af123bdbb3b39a21903d85c78462d047: [Backport #18241]
https://git.ruby-lang.org/ruby.git/commit/?id=62a33dfa16 From 62a33dfa168504f8ee77d493979e66616ebe1da8 Mon Sep 17 00:00:00 2001 From: nagachika <nagachika@r...> Date: Fri, 24 Dec 2021 14:36:45 +0900 Subject: 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(-) --- string.c | 19 ++++++++++--------- version.h | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/string.c b/string.c index 1db7acc8c8d..1777125b2bf 100644 --- a/string.c +++ b/string.c @@ -3155,13 +3155,13 @@ rb_str_concat_literals(size_t num, const VALUE *strary) https://github.com/ruby/ruby/blob/trunk/string.c#L3155 /* * 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) https://github.com/ruby/ruby/blob/trunk/string.c#L3193 /* * 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) https://github.com/ruby/ruby/blob/trunk/string.c#L3274 /* * 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 6903a7c6821..e3c26230f6c 100644 --- a/version.h +++ b/version.h @@ -12,7 +12,7 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L12 # 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/