On 8/8/06, Trans <transfire / gmail.com> wrote:
> Where's the Fixnum?
>
>   class X < Array
>     def to_s
>       join('.')
>     end
>     def inspect ; to_s ; end
>   end
>   x=X.new
>   x << 1
>   x << 2
>   x << 3
>   x          #=> 1.2.3
>   x.class    #=> X
>   File.join( x, 'index.rb' )
>
>   TypeError: can't convert Fixnum into String
>         from (irb):19:in `join'
>         from (irb):19
>         from :0
>
>
>

File.join doesn't use Array#to_s. See:

irb(main):001:0> File.join %w(a b), "c"
=> "a/b/c"
irb(main):002:0> File.join ["a", "b"]
=> "a/b"
irb(main):003:0>
irb(main):004:0> File.join [1, 2]
TypeError: can't convert Fixnum into String
        from (irb):4:in `join'
        from (irb):4
        from :0
irb(main):005:0>

-- 
- Simen