Skip to content

Commit 477c505

Browse files
authored
[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.
1 parent 528ec70 commit 477c505

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5084,7 +5084,7 @@ rb_ary_concat(VALUE x, VALUE y)
50845084
* When string argument +string_separator+ is given,
50855085
* equivalent to <tt>self.join(string_separator)</tt>:
50865086
*
5087-
* [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {:foo=>0}"
5087+
* [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {foo: 0}"
50885088
*
50895089
*/
50905090

doc/syntax/pattern_matching.rdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ The "rest" part of a pattern also can be bound to a variable:
247247
else
248248
"not matched"
249249
end
250-
#=> "matched: 1, {:b=>2, :c=>3}"
250+
#=> "matched: 1, {b: 2, c: 3}"
251251

252252
Binding to variables currently does NOT work for alternative patterns joined with <code>|</code>:
253253

hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3490,7 +3490,7 @@ inspect_hash(VALUE hash, VALUE dummy, int recur)
34903490
* Returns a new String containing the hash entries:
34913491
34923492
* h = {foo: 0, bar: 1, baz: 2}
3493-
* h.inspect # => "{:foo=>0, :bar=>1, :baz=>2}"
3493+
* h.inspect # => "{foo: 0, bar: 1, baz: 2}"
34943494
*
34953495
*/
34963496

object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3827,7 +3827,7 @@ rb_String(VALUE val)
38273827
*
38283828
* String([0, 1, 2]) # => "[0, 1, 2]"
38293829
* String(0..5) # => "0..5"
3830-
* String({foo: 0, bar: 1}) # => "{:foo=>0, :bar=>1}"
3830+
* String({foo: 0, bar: 1}) # => "{foo: 0, bar: 1}"
38313831
*
38323832
* Raises +TypeError+ if +object+ cannot be converted to a string.
38333833
*/

0 commit comments

Comments
 (0)