readlines(p1, p2 = v2, p3 = v3, p4 = v4, p5 = {})
public
Reads the entire file specified by name as individual lines, and returns those lines in an array. Lines are separated by sep.
a = IO.readlines("testfile") a[0] #=> "This is line one\n" b = IO.readlines("testfile", chomp: true) b[0] #=> "This is line one"
If the last argument is a hash, it’s the keyword argument to open.
Options for getline
The options hash accepts the following keys:
:chomp |
When the optional chomp keyword argument has a true value, n, r, and rn will be removed from the end of each line. |
See also IO.read for details about open_args.