From: Josh Cheek Date: 2010-03-01T12:25:05+09:00 Subject: Re: Array#join using to_a if defined --000e0cd1ac5488be730480b4cb7a Content-Type: text/plain; charset=ISO-8859-1 On Sun, Feb 28, 2010 at 12:53 PM, Benoit Daloze wrote: > Hi, > > I got recently an unexpected result using Array#join. > > In my thoughts, Array#join is sth like adding the separator between every > element#to_s. > > That is what seems to happen when there is no any #to_a method defined in > an > element: > > For example, > class N < Struct.new(:n) > def to_s > 'to_s' > end > end > > [N.new(2), N.new(3)].join(' ') #=> "2 3" and not "to_s to_s" > I got "to_s to_s" in 1.8.6, 1.8.7, and 1.9.1 --000e0cd1ac5488be730480b4cb7a--