method

lines

v1_8_7_72 - Show latest stable - Class: IO
lines(...)
public

Returns an enumerator that gives each line in ios. The stream must be opened for reading or an IOError will be raised.

   f = File.new("testfile")
   f.lines.to_a  #=> ["foo\n", "bar\n"]
   f.rewind
   f.lines.sort  #=> ["bar\n", "foo\n"]