method

lines

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

Returns an enumerator that gives each line in the string. If a block is given, it iterates over each line in the string.

   "foo\nbar\n".lines.to_a   #=> ["foo\n", "bar\n"]
   "foo\nb ar".lines.sort    #=> ["b ar", "foo\n"]