Skip to content

Instantly share code, notes, and snippets.

@ryanveroniwooff
Last active February 1, 2017 10:12
Show Gist options
  • Save ryanveroniwooff/589a1b9bf91f2a67fa75a88a50a4618d to your computer and use it in GitHub Desktop.
Save ryanveroniwooff/589a1b9bf91f2a67fa75a88a50a4618d to your computer and use it in GitHub Desktop.
Outputs variable to file in ruby language
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