pos=(n)
ファイルポインタを指定位置に移動します。 IO#seek(n, IO::SEEK_SET) と同じです。
例 IO.write("testfile", "This is line one\nThis is line two\n") File.open("testfile") do |f| f.pos # => 0 f.pos = 17 f.gets # => "This is line two\n" end
IO.write("testfile", "This is line one\nThis is line two\n") File.open("testfile") do |f| f.pos # => 0 f.pos = 17 f.gets # => "This is line two\n" end