From: "greggzst (Grzegorz Jakubiak)" <noreply@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:105747] [Ruby master Bug#18261] String#prepend inconsistent documentation
Date: Fri, 22 Oct 2021 08:45:32 +0000 (UTC) [thread overview]
Message-ID: <redmine.issue-18261.20211022084532.13458@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-18261.20211022084532.13458@ruby-lang.org
Issue #18261 has been reported by greggzst (Grzegorz Jakubiak).
----------------------------------------
Bug #18261: String#prepend inconsistent documentation
https://bugs.ruby-lang.org/issues/18261
* Author: greggzst (Grzegorz Jakubiak)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.2
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I noticed documentation at https://docs.ruby-lang.org/en/3.0.0/String.html#method-i-prepend says:
```
Returns a new String containing the concatenation of all given other_strings and self:
```
but `String#prepend` modifies string in place; code example:
```ruby
[1] pry(main)> string = 'my_string'
=> "my_string"
[2] pry(main)> string.object_id
=> 135120
[3] pry(main)> string.prepend('prefix_').object_id
=> 135120
[4] pry(main)> string
=> "prefix_my_string"
```
I checked the docs in the `string.c` file on github and they are actually correct:
```
Prepends each string in +other_strings+ to +self+ and returns +self+:
```
--
https://bugs.ruby-lang.org/
next parent reply other threads:[~2021-10-22 8:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 8:45 greggzst (Grzegorz Jakubiak) [this message]
2021-10-22 9:00 ` [ruby-core:105748] [Ruby master Bug#18261] String#prepend inconsistent documentation mame (Yusuke Endoh)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.issue-18261.20211022084532.13458@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).