So I have a simple ruby script I created for an assignment and my
professor wants us to output the original source code to a formatted
text file.
As of now I have a started separate script opening the assignment as
read then I create a new file with writing privileges. But I’m not sure
what I do next.
All files are in the same project folder.
File.open(“Assignment.rb”, “r”) do |file|
new_file = File.new(“sourcecode.txt”, “w+”)
while line = file.gets
new_file.puts
end
end
I’m not entirely sure where to go to next,any help would greatly be
appreciated!
So I have a simple ruby script I created for an assignment and my
professor wants us to output the original source code to a formatted
text file.
As of now I have a started separate script opening the assignment as
read then I create a new file with writing privileges. But I’m not sure
what I do next.
That doesn’t make any sense to me. You could copy the file using the
file manager of your operating system or the command line, but what for?
The Ruby source code essentially is a text file.
But what do you mean by a “formatted text file”???