8000 [DOC] Tweaks to Array.try_convert by BurdetteLamar · Pull Request #11260 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@BurdetteLamar
Copy link
Member
  • Adds an introductory overview statement.
  • Simplifies "case" cascade (if, otherwise, otherwise).

@BurdetteLamar BurdetteLamar added the Documentation Improvements to documentation. label Jul 27, 2024
array.c Outdated
Comment on lines 1022 to 1023
* - Otherwise if +object+ responds to <tt>:to_ary</tt>,
* returns <tt>object.to_ary</tt>.
Copy link
Member

Choose a reason for hiding this comment

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

This may be worth to mention, that a TypeError is raised if the result of object.to_ary is neither an Array nor nil.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@BurdetteLamar BurdetteLamar requested a review from nobu July 29, 2024 16:03
array.c Outdated
* Returns +nil+ if +object+ does not respond to <tt>:to_ary</tt>
*
* Raises an exception unless <tt>object.to_ary</tt> returns an +Array+ object.
* Raises TypeError unless <tt>object.to_ary</tt> returns an +Array+ object or +nil+.
Copy link
Member

Choose a reason for hiding this comment

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

I think we should move this under the second bullet point since object could be an array or nil, then the return value of object.to_ary is never checked.

Copy link
Member Author

Choose a reason for hiding this comment

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

Modified.

@peterzhu2118 peterzhu2118 merged commit d2b8fd0 into ruby:master Jul 30, 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.

3 participants

0