From 8aeca5ce404486e3ec67a1b3c895b043567a1350 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Fri, 2 Aug 2024 17:23:50 +0100 Subject: [PATCH] Tweaks to Array::try_convert --- array.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/array.c b/array.c index 1449890b6c..9ad5c68af7 100644 --- a/array.c +++ b/array.c @@ -1016,17 +1016,16 @@ rb_to_array(VALUE ary) * call-seq: * 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+. - * - Otherwise if +object+ responds to :to_ary. - * calls object.to_ary: + * If +object+ is an array, returns +object+. * - * - If the return value is an +Array+ or +nil+, returns that value. - * - Otherwise, raises TypeError. - * - * - Otherwise returns +nil+. + * Otherwise if +object+ responds to :to_ary. + * calls object.to_ary: + * if the return value is an array or +nil+, returns that value; + * if not, raises TypeError. * + * Otherwise returns +nil+. */ static VALUE