Project

General

Profile

Actions

Bug #18261

closed

String#prepend inconsistent documentation

Added by greggzst (Grzegorz Jakubiak) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:105747]

Description

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:

[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+:

Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Bug #18241: Question on String Concatentation DocumentationClosedActions
Actions #1

Updated by mame (Yusuke Endoh) over 2 years ago

  • Is duplicate of Bug #18241: Question on String Concatentation Documentation added

Updated by mame (Yusuke Endoh) over 2 years ago

This is a duplicate of #18241 and already fixed in the development branch. Thanks anyway.

Actions #3

Updated by mame (Yusuke Endoh) over 2 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0