From: Farrel Lifson Date: 2006-08-08T19:39:01+09:00 Subject: Re: File.join : can't convert Fixnum into String ? On 08/08/06, Trans 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 > > > Works for me irb(main):001:0> class X < Array irb(main):002:1> def to_s irb(main):003:2> join('.') irb(main):004:2> end irb(main):005:1> def inspect ; to_s ; end irb(main):006:1> end => nil irb(main):007:0> x=X.new => irb(main):008:0> x << 1 => 1 irb(main):009:0> x << 2 => 1.2 irb(main):010:0> x << 3 => 1.2.3 irb(main):011:0> x.class => X irb(main):012:0> File.join(x,'index.rb') => "1/2/3/index.rb" I'm running 1.8.2 on Windows 2000. Farrel