From: daz Date: 2004-05-21T07:13:47+09:00 Subject: Re: [rcr] make File#dup intuitive Simon Strandgaard wrote: > > position is not copied.. try this example for yourself > > f1 = File.open(__FILE__, 'r') > f1.seek(5) > p f1.pos # -> 5 > f2 = f1.dup > p f2.pos # -> garbage > > server> ruby a.rb > 5 > 93 > server> > > This is really non-intuitive that you have to do > a seek afterwards. Its the same as if you clone a string, > but have to copy the string-content yourself. > Where is logic here? > Works here. # ruby 1.9.0 (2004-04-27) [i586-bccwin32] # ruby 1.8.0 (2003-05-15) [i386-mswin32] # ruby 1.6.7 (2002-03-01) [i586-mswin32] mainframe_19(north_garage)> ruby pos.rb 5 5 mainframe_19(north_garage)> daz