S
Simon Strandgaard
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?
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?