My question is this:
How to read in only the last line of a file, in pure ruby, no external
commands or libraries?
That means no full read-in of the whole file.
So no .readlines() call and similar.
I was told that I can use IO#seek to seek to the last
position, then probably find the first occurance of \n
there (seeking in the other direction; I am unsure how
to do that actually, what if I read in through the
first \n there?).
But how to do this in a simple fashion?
I’d then like to customize File, through a:
Which would very quickly give me only the last line,
delimiter being \n.