Update to Array#join

Gary Wright <[email protected]> Wed, 14 Feb 2007 19:57:52 -0500
Newsgroups gmane.comp.lang.ruby.documentation
Message-ID <[email protected]>
This is my first attempt to post a documentation patch so don't be
too harsh. I just used 'svn diff array.c' against the 1.8.5 branch.
Should I be submitting diffs against trunk?

This patch clarifies the behavior of Array#join and was
prompted by a recent thread on ruby-talk.

Gary Wright


Index: array.c
===================================================================
--- array.c     (revision 11744)
+++ array.c     (working copy)
@@ -1299,11 +1299,16 @@
   *  call-seq:
   *     array.join(sep=$,)    -> str
   *
- *  Returns a string created by converting each element of the array to
- *  a string, separated by <i>sep</i>.
+ *  Returns a string created by converting each element of the array
+ *  to a string, separated by <i>sep</i>. For every element that is an
+ *  array, the element is converted to a string by applying the  
conversion
+ *  procedure recursively. Elements that are not strings or arrays are
+ *  converted by calling to_s.
   *
- *     [ "a", "b", "c" ].join        #=> "abc"
- *     [ "a", "b", "c" ].join("-")   #=> "a-b-c"
+ *     [ "a", "b", "c" ].join             #=> "abc"
+ *     [ "a", "b", "c" ].join("-")        #=> "a-b-c"
+ *     [ "w", ["x", "y"], "z"].join("-")  #=> "w-x-y-z"
+ *     [ nil, :a, 1].join("/")            #=> "/a/1"
   */
static VALUE