1 | initial version |
In Ruby, you can provide a text file as input using the File class. Here is an example of how to read contents of a text file:
file = File.open("file.txt", "r")
contents = file.read
puts contents
file.close
This code opens the file named "file.txt" in read mode, reads its contents, prints them to the console, and then closes the file.