Slightly off topic, but if you want an exception, couldn't you just use
f.readline?  That automatically throws EOFError.

-- 
Posted via http://www.ruby-forum.com/.