Reading Files
Lesson 26Author : GOUP
Last Updated : September, 2020
Code
File.open("employees.txt", "r") do |file|
for line in file.readlines()
puts line
end
end
# ---------------
# or
# ---------------
file = File.open("employees.txt", "r")
puts file.read
file.close()