This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

readlines

        # IO.readlines

(from ruby core)
---
    IO.readlines(name, sep=$/ [, getline_args, open_args])     -> array
    IO.readlines(name, limit [, getline_args, open_args])      -> array
    IO.readlines(name, sep, limit [, getline_args, open_args]) -> array
    File.readlines(name, sep=$/ [, getline_args, open_args])     -> array
    File.readlines(name, limit [, getline_args, open_args])      -> array
    File.readlines(name, sep, limit [, getline_args, open_args]) -> array

---

Reads the entire file specified by *name* as individual lines, and
returns those lines in an array. Lines are separated by *sep*.

If `name` starts with a pipe character (`"|"`) and the receiver is the
IO class, a subprocess is created in the same way as Kernel#open, and
its output is returned. Consider to use File.readlines to disable the
behavior of subprocess invocation.

    a = File.readlines("testfile")
    a[0]   #=> "This is line one\n"

    b = File.readlines("testfile", chomp: true)
    b[0]   #=> "This is line one"

    IO.readlines("|ls -a")     #=> [".\n", "..\n", ...]

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 `\r\n` will be removed from the end of each line.


See also IO.read for details about `name` and open_args.


(from ruby core)
---
    ios.readlines(sep=$/ [, getline_args])     -> array
    ios.readlines(limit [, getline_args])      -> array
    ios.readlines(sep, limit [, getline_args]) -> array

---

Reads all of the lines in *ios*, and returns them in an array. Lines are
separated by the optional *sep*. If *sep* is `nil`, the rest of the
stream is returned as a single record. If the first argument is an
integer, or an optional second argument is given, the returning string
would not be longer than the given value in bytes. The stream must be
opened for reading or an IOError will be raised.

    f = File.new("testfile")
    f.readlines[0]   #=> "This is line one\n"

    f = File.new("testfile", chomp: true)
    f.readlines[0]   #=> "This is line one"

See IO.readlines for details about getline_args.



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.