0
f= File.open('path_to_file','w')
f.lineno
#=> 0
f.gets
#=>"this is the content of the first line"
f.lineno
#=>1 # the lineno cooresponse to the next read point of IO#gets
f.rewind
f.lineno
#=>0
f.read
#=>"all the content in the file"
f.lineno
#=>0 # the lineno still is the beginning
f.read
#=>"" # but I can't get anyting , it seems like the read point reach to the end of the file, so the f.lineno should be 3, instead of 0
或有任何其他辦法知道IO流爲什麼IO#LINENO doen't送花兒給人指示IO#下一次讀點讀
f.lineno
#=>0
非常明確的答案,也許IO#tell是IO $ pos的別名 – mko