Re: Update to Array#join
Gary Wright <[email protected]> Thu, 15 Feb 2007 09:15:32 -0500
| Newsgroups | gmane.comp.lang.ruby.documentation |
|---|---|
| Message-ID | <[email protected]> |
On Feb 15, 2007, at 5:35 AM, Ryan Davis wrote: > try something like: > > Every sub-array is converted to a string by applying join > recursively, essentially flattening the array. I thought of this also but it suggests to me that #join itself is called on the sub-array, which is not true. The recursive algorithm is implemented entirely within Array#join. I considered this detail important because if someone had defined #join for the subarray (as a singleton method) then they might think they could 'override' the behavior of #join for that element of the array. Anyway, that is why I avoided any reference to #flatten and to #join. Gary Wright