[DOC] Tweaks to Array.try_convert (#11260)
This commit is contained in:
parent
91bb6afa75
commit
d2b8fd0f37
Notes:
git
2024-07-30 20:31:52 +00:00
Merged-By: peterzhu2118 <peter@peterzhu.ca>
13
array.c
13
array.c
@ -1016,14 +1016,17 @@ rb_to_array(VALUE ary)
|
||||
* call-seq:
|
||||
* Array.try_convert(object) -> object, new_array, or nil
|
||||
*
|
||||
* If +object+ is an +Array+ object, returns +object+.
|
||||
* Attempts to convert the given +object+ to an +Array+ object:
|
||||
*
|
||||
* Otherwise if +object+ responds to <tt>:to_ary</tt>,
|
||||
* calls <tt>object.to_ary</tt> and returns the result.
|
||||
* - If +object+ is an +Array+ object, returns +object+.
|
||||
* - Otherwise if +object+ responds to <tt>:to_ary</tt>.
|
||||
* calls <tt>object.to_ary</tt>:
|
||||
*
|
||||
* Returns +nil+ if +object+ does not respond to <tt>:to_ary</tt>
|
||||
* - If the return value is an +Array+ or +nil+, returns that value.
|
||||
* - Otherwise, raises TypeError.
|
||||
*
|
||||
* - Otherwise returns +nil+.
|
||||
*
|
||||
* Raises an exception unless <tt>object.to_ary</tt> returns an +Array+ object.
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
Loading…
x
Reference in New Issue
Block a user