Some of the stuff that makes me love ruby
Read a file
File.read('file.txt')
Read a file line by line
array_of_lines = File.readlines('file.txt')
although I’d probably use it more like this:
File.readlines('file.txt').each {|l| puts line }
Some of the stuff that makes me love ruby
File.read('file.txt')
array_of_lines = File.readlines('file.txt')
although I’d probably use it more like this:
File.readlines('file.txt').each {|l| puts line }