IO#lineno= doesn't work the way I expected

Jens Wille wrote:

and wrt tim's comment: since we're using IO#gets there's no need to
check for empty files. with IO#readline it's another matter. but why
bother? did you (tim) have something else in mind?

All I had in mind was that, when I write a piece of code that expects a file to have at least 2 lines, then I need to think for a second about what it should do when the file has only 1 line, or 0 lines. It depends on the program. That's all.

···

--
RMagick: http://rmagick.rubyforge.org/

Tim Hunter [2008-11-16 15:52]:

Jens Wille wrote:

and wrt tim's comment: since we're using IO#gets there's no
need to check for empty files. with IO#readline it's another
matter. but why bother? did you (tim) have something else in
mind?

All I had in mind was that, when I write a piece of code that
expects a file to have at least 2 lines, then I need to think for
a second about what it should do when the file has only 1 line,
or 0 lines. It depends on the program. That's all.

ah, ok, i see. thanks!