Tweaks to Array::try_convert
This commit is contained in:
parent
e62c2ce0e0
commit
8aeca5ce40
Notes:
git
2024-08-06 19:37:41 +00:00
15
array.c
15
array.c
@ -1016,17 +1016,16 @@ rb_to_array(VALUE ary)
|
|||||||
* call-seq:
|
* call-seq:
|
||||||
* Array.try_convert(object) -> object, new_array, or nil
|
* Array.try_convert(object) -> object, new_array, or nil
|
||||||
*
|
*
|
||||||
* Attempts to convert the given +object+ to an +Array+ object:
|
* Attempts to return an array, based on the given +object+.
|
||||||
*
|
*
|
||||||
* - If +object+ is an +Array+ object, returns +object+.
|
* If +object+ is an array, returns +object+.
|
||||||
* - Otherwise if +object+ responds to <tt>:to_ary</tt>.
|
|
||||||
* calls <tt>object.to_ary</tt>:
|
|
||||||
*
|
*
|
||||||
* - If the return value is an +Array+ or +nil+, returns that value.
|
* Otherwise if +object+ responds to <tt>:to_ary</tt>.
|
||||||
* - Otherwise, raises TypeError.
|
* calls <tt>object.to_ary</tt>:
|
||||||
*
|
* if the return value is an array or +nil+, returns that value;
|
||||||
* - Otherwise returns +nil+.
|
* if not, raises TypeError.
|
||||||
*
|
*
|
||||||
|
* Otherwise returns +nil+.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user