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"]
Show source
Register or log in to add new notes.