title: clean ruby file before writing new content to it
body: <p>Can somebody please guide me a way to <strong>clean all existing content in a file before</strong>  <strong>writing new info to it in Ruby</strong>? I'm writing the contents of this file with the code below:</p>
  
  <pre><code>logfile = File.new(filepath, "w")
  logfile.write("my content")
  </code></pre>
  
  <p>However, I want all existing content in this "logfile" to be deleted before I write new info to it. How can I do this?</p>