From e72e18b31d79b16b307c0bdf5b07416ff3ab595e Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Mon, 30 Sep 2024 16:31:42 -0500 Subject: [PATCH] [DOC] Tweaks for Array#join --- array.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/array.c b/array.c index 5f707b0a5f..72a1a4f135 100644 --- a/array.c +++ b/array.c @@ -2908,31 +2908,32 @@ rb_ary_join(VALUE ary, VALUE sep) /* * call-seq: - * array.join ->new_string * array.join(separator = $,) -> new_string * - * Returns the new String formed by joining the array elements after conversion. - * For each element +element+: + * Returns the new string formed by joining the converted elements of +self+; + * for each element +element+: * - * - Uses element.to_s if +element+ is not a kind_of?(Array). - * - Uses recursive element.join(separator) if +element+ is a kind_of?(Array). + * - Converts recursively using element.join(separator) + * if +element+ is a kind_of?(Array). + * - Otherwise, converts using element.to_s. * - * With no argument, joins using the output field separator, $,: + * With no argument given, joins using the output field separator, $,: * * a = [:foo, 'bar', 2] * $, # => nil * a.join # => "foobar2" * - * With \string argument +separator+, joins using that separator: + * With string argument +separator+ given, joins using that separator: * * a = [:foo, 'bar', 2] * a.join("\n") # => "foo\nbar\n2" * - * Joins recursively for nested Arrays: + * Joins recursively for nested arrays: * * a = [:foo, [:bar, [:baz, :bat]]] * a.join # => "foobarbazbat" * + * Related: see {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting]. */ static VALUE rb_ary_join_m(int argc, VALUE *argv, VALUE ary)