-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[DOC] Tweaks to Array.try_convert #11260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Adds an introductory overview statement.
- Simplifies "case" cascade (if, otherwise, otherwise).
array.c
Outdated
| * - Otherwise if +object+ responds to <tt>:to_ary</tt>, | ||
| * returns <tt>object.to_ary</tt>. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
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+. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified.