[DOC] Fix output examples containing old Hash#inspect format

The inspect format was intentionally changed as an outcome of
[Bug #20433] [ruby-core:118668], but some documentation update
was missing, as [Bug #20962] pointed out. Update some output
examples that clearly use Hash#inspect.
This commit is contained in:
tomoya ishida 2024-12-19 02:08:15 +09:00 committed by GitHub
parent 528ec70604
commit 477c505ac0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2024-12-18 17:09:11 +00:00
Merged: https://github.com/ruby/ruby/pull/12384

Merged-By: XrXr
4 changed files with 4 additions and 4 deletions

View File

@ -5084,7 +5084,7 @@ rb_ary_concat(VALUE x, VALUE y)
* When string argument +string_separator+ is given,
* equivalent to <tt>self.join(string_separator)</tt>:
*
* [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {:foo=>0}"
* [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {foo: 0}"
*
*/

View File

@ -247,7 +247,7 @@ The "rest" part of a pattern also can be bound to a variable:
else
"not matched"
end
#=> "matched: 1, {:b=>2, :c=>3}"
#=> "matched: 1, {b: 2, c: 3}"
Binding to variables currently does NOT work for alternative patterns joined with <code>|</code>:

2
hash.c
View File

@ -3490,7 +3490,7 @@ inspect_hash(VALUE hash, VALUE dummy, int recur)
* Returns a new String containing the hash entries:
* h = {foo: 0, bar: 1, baz: 2}
* h.inspect # => "{:foo=>0, :bar=>1, :baz=>2}"
* h.inspect # => "{foo: 0, bar: 1, baz: 2}"
*
*/

View File

@ -3827,7 +3827,7 @@ rb_String(VALUE val)
*
* String([0, 1, 2]) # => "[0, 1, 2]"
* String(0..5) # => "0..5"
* String({foo: 0, bar: 1}) # => "{:foo=>0, :bar=>1}"
* String({foo: 0, bar: 1}) # => "{foo: 0, bar: 1}"
*
* Raises +TypeError+ if +object+ cannot be converted to a string.
*/