The easiest way if the file isn’t too long is:
puts File.read(file_name)
Indeed, IO.read
or File.read
automatically close the file, so there is no need to use File.open
with a block.
The easiest way if the file isn’t too long is:
puts File.read(file_name)
Indeed, IO.read
or File.read
automatically close the file, so there is no need to use File.open
with a block.