Last active
February 1, 2017 10:12
-
-
Save ryanveroniwooff/589a1b9bf91f2a67fa75a88a50a4618d to your computer and use it in GitHub Desktop.
Outputs variable to file in ruby language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.output_to_file(item) | |
fname = "program-output.txt" | |
time = Time.new.strftime("%a, %b %d @ %I:%M:%S %p") | |
file = File.open(fname, "a") # a = append, w = wipe | |
file.puts "#{time}: #{item} \n\n" | |
file.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment