Quick reference for efficient coding
View the Project on GitHub YumaYX/RubyQuickReference
This Ruby code snippet uses the File.write method to create a file named ‘filewr.txt’ and write the text ‘Hello’ into it.
File.write
File.write('filewr.txt', 'Hello') #=> 5
Executed with Ruby 3.3.5
3.3.5