This snippet shows how to read a file and puts all the lines into an array.

f = *open('file.txt').map {|l| l.rstrip} # => ["Hi, from the", "txt file."]

Explanation

The open method returns an IO object, that include the Enumerable module, now we can just use #map (or #collect).

The splat operator is only a sugar syntactical shortcut for map.