Seems like
1. File.join is recursive on arrays. i.e. your example is [almost] equivalent to
File.join([1,2,3], 'index.rb') and that is equivalent to
File.join(File.join(1,2,3), 'index.rb')
2. File.join doesn't do any type conversions. I.e. it won't call your to_s.
···
On 8/8/06, Simen Edvardsen <toalett@gmail.com> wrote:
On 8/8/06, Trans <transfire@gmail.com> wrote:
> Where's the Fixnum?
File.join doesn't use Array#to_s. See:
> > Where's the Fixnum?
> File.join doesn't use Array#to_s. See:
Seems like
1. File.join is recursive on arrays. i.e. your example is [almost] equivalent to
File.join([1,2,3], 'index.rb') and that is equivalent to
File.join(File.join(1,2,3), 'index.rb')
2. File.join doesn't do any type conversions. I.e. it won't call your to_s.
It does type conversion, which is why it says it can't convert Fixnum
to String. But you are right that it does not call #to_s, rather it
calls #to_str. But it doesn't call to_str for an Array, as you point
out. Seem kind of anti-duck. But anyhow guess I'll have to delegate
instead of subclass.
Thanks,
T.
···
On 8/8/06, Simen Edvardsen <toalett@gmail.com> wrote:
> On 8/8/06, Trans <transfire@gmail.com> wrote: