title: Ruby 1.9.2 export a CSV string without generating a file
body: <p>I just can't get the 'To a String' example under 'Writing' <a href="http://ruby-doc.org/stdlib/libdoc/csv/rdoc/classes/CSV.html" rel="noreferrer">example in the documentation</a> to work at all.</p>
  
  <p>ruby -v returns:
  ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]</p>
  
  <p>The example from the documentation I can't working is here:</p>
  
  <pre><code>csv_string = CSV.generate do |csv|
      csv &lt;&lt; ["row", "of", "CSV", "data"]
      csv &lt;&lt; ["another", "row"]
  end
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>wrong number of arguments (0 for 1)
  </code></pre>
  
  <p>So it seems like I am missing an argument, in the documentation <a href="http://ruby-doc.org/stdlib/libdoc/csv/rdoc/classes/CSV.html#M000182" rel="noreferrer">here</a> it states:</p>
  
  <pre><code>This method wraps a String you provide, or an empty default String
  </code></pre>
  
  <p>But when I pass in a empty string, it gives me the following error:</p>
  
  <pre><code>No such file or directory - 
  </code></pre>
  
  <p>I am not looking to generate a csv file, I just wanted to create a string of csv that I send as text to the user.</p>