I've got a method where I open a file and I want to add lines to the end:
def add_to_file(path, text)
File.open(path, 'ab') { |file| file.write(???) }
end
The ??? represents what I put in, to make 'text' go to the next line in the file.
What do I do to 'text' to get it to go to the next line, rather than just joined to the previous word? ('text' is a local variable)
def add_to_file(path, text)
File.open(path, 'ab') { |file| file.write(???) }
end
The ??? represents what I put in, to make 'text' go to the next line in the file.
What do I do to 'text' to get it to go to the next line, rather than just joined to the previous word? ('text' is a local variable)