@@ -3107,28 +3107,20 @@ rb_ary_join(VALUE ary, VALUE sep)
31073107 * call-seq:
31083108 * join(separator = $,) -> new_string
31093109 *
3110- * Returns the new string formed by joining the converted elements of +self+;
3111- * for each element +element+ :
3110+ * Returns the new string formed by joining the string- converted elements of +self+
3111+ * with the given +separator+ (defaults to <tt>$,</tt>) :
31123112 *
3113- * - Converts recursively using <tt>element.join(separator)</tt>
3114- * if +element+ is a <tt>kind_of?(Array)</tt>.
3115- * - Otherwise, converts using <tt>element.to_s</tt>.
3113+ * $, # => nil
3114+ * %w[].join # => ""
3115+ * %w[foo].join # => "foo"
3116+ * a = %w[foo bar baz] # => ["foo", "bar", "baz"]
3117+ * a.join # => "foobarbaz"
3118+ * a.join('|') # => "foo|bar|baz"
3119+ * a.join(' :|: ') # => "foo :|: bar :|: baz"
31163120 *
3117- * With no argument given, joins using the output field separator, <tt>$,</tt> :
3121+ * Flattens and joins nested arrays :
31183122 *
3119- * a = [:foo, 'bar', 2]
3120- * $, # => nil
3121- * a.join # => "foobar2"
3122- *
3123- * With string argument +separator+ given, joins using that separator:
3124- *
3125- * a = [:foo, 'bar', 2]
3126- * a.join("\n") # => "foo\nbar\n2"
3127- *
3128- * Joins recursively for nested arrays:
3129- *
3130- * a = [:foo, [:bar, [:baz, :bat]]]
3131- * a.join # => "foobarbazbat"
3123+ * [:foo, [:bar, [:baz, :bat]]].join # => "foobarbazbat"
31323124 *
31333125 * Related: see {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting].
31343126 */
0 commit comments