Skip to content

Commit

Permalink
merge revision(s) c6706f1: [Backport #18241]
Browse files Browse the repository at this point in the history
	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(-)
  • Loading branch information
nagachika committed Dec 24, 2021
1 parent badffc7 commit 62a33df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions string.c
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion version.h
Expand Up @@ -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
Expand Down

0 comments on commit 62a33df

Please sign in to comment.