Quick reference for efficient coding
View the Project on GitHub YumaYX/RubyQuickReference
This Ruby code uses the File.read method to read the contents of a file named ‘filewr.txt’ and returns the content as a string.
File.read
File.read('filewr.txt') #=> "Hello"
Executed with Ruby 3.3.5
3.3.5