Where’s the Fixnum?
File.join doesn’t use Array#to_s. See:
Seems like
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’)
File.join doesn’t do any type conversions. I.e. it won’t call your
to_s.
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.