There are quite a few ways to open a text file with Ruby and then process its contents, but this example probably shows the most concise way to do it:
# ruby sample code. # process every line in a text file with ruby (version 1). file='GettysburgAddress.txt' File.readlines(file).each do |line| puts line end
As you can see, this example code is very concise, and inside the processing loop you can do whatever you need to do with the line variable.
