use each_line which works in 1.8.7 and 2.0