title: How do I detect if a CSV is empty or has no rows?
body: <p>I have an array <code>info</code>, where I am reading each item and adding it to a CSV file like so:</p>
  
  <pre><code>  info.each do |listing|
      CSV.open(csvfile, "a+") do |csv|
        csv &lt;&lt; listing
      end
    end
  </code></pre>
  
  <p>However, what I want to do is when the CSV is empty (i.e. this is the first row being added to this specific CSV) I will add a header first before adding any data. A header being a row that just has data-categories: First Name, Last Name, Address, etc.</p>
  
  <p>If I add it to that loop, it will add it after each record.</p>
  
  <p>Also, there is no guarantee that the first item in the array will be the first item in the CSV. The CSV could be empty by the time the iterator is at <code>i[10]</code> for example.</p>
  
  <p>How do I approach this?</p>