diff --git a/array.c b/array.c index 0b527af3b3..ccf1cd6cc6 100644 --- a/array.c +++ b/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 :to_ary, - * calls object.to_ary and returns the result. + * - If +object+ is an +Array+ object, returns +object+. + * - Otherwise if +object+ responds to :to_ary. + * calls object.to_ary: * - * Returns +nil+ if +object+ does not respond to :to_ary + * - If the return value is an +Array+ or +nil+, returns that value. + * - Otherwise, raises TypeError. + * + * - Otherwise returns +nil+. * - * Raises an exception unless object.to_ary returns an +Array+ object. */ static VALUE