📅  最后修改于: 2022-03-11 15:04:49.654000             🧑  作者: Mango
# open and write to a file with ruby
open('myfile.out', 'w') do |f|
f.puts "Hello, world."
end
# an alternative approach:
open('myfile.out', 'w') do |f|
f << "Hello, world.\n"
end