Actually, it can simply be:

```ruby
while reader.advance
  ...
end
```

...since advance returns whether there was a line to advance to.

Good suggestion. Noting it down.