Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

BurdetteLamar
Copy link
Member

Tune up Array::[]. Removes two examples that don't actually call Array::[].

@BurdetteLamar BurdetteLamar added the Documentation Improvements to documentation. label Jul 26, 2024
array.c Outdated
Comment on lines 1164 to 1165
* Array.[]( 1, 'a', /^A/) # => [1, "a", /^A/]
* Array.[] # => []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also keep the example using Array[1, 'a', /^A/]? It's the same method call but using different syntax (the most idiomatic syntax).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored (and moved the idiomatic syntax to top).

array.c Outdated
* Returns a new array populated with the given objects.
* Returns a new +Array+ object, populated with the given objects:
*
* Array.[]( 1, 'a', /^A/) # => [1, "a", /^A/]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: extra space:

Suggested change
* Array.[]( 1, 'a', /^A/) # => [1, "a", /^A/]
* Array.[](1, 'a', /^A/) # => [1, "a", /^A/]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. (There are no nits.)

@peterzhu2118 peterzhu2118 merged commit 477f672 into ruby:master Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements to documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants