I want to add a new line after a string is inserted.
My current code looks like this:
File.open(filename, 'a') do |file|
file.write @string
end
How could I add a new line after the string is inserted?
I want to add a new line after a string is inserted.
My current code looks like this:
File.open(filename, 'a') do |file|
file.write @string
end
How could I add a new line after the string is inserted?
In case if you can't use IO#puts:
file.write "text#{$/}"
where $/ represents OS-dependent new line separator.