title: Opening email attachment with roo
body: <p>I need to manipulate xls files which are read from email attachments. Due to performance reasons I need to use the Roo gem. The problem here is passing the attachment to the Roo. Spreadsheet gem could read StringIO directly but Roo doesn't seem to have such capability. (<a href="https://stackoverflow.com/questions/19695986/is-there-any-way-to-get-roo-to-accept-stringio-objects-in-place-of-files">Is there any way to get Roo to accept StringIO objects in place of files?</a>)</p>
  
  <p>I have found this solution</p>
  
  <pre><code>attachment = mail.attachments.first
  file = Tempfile.new(['attachment', '.xls'], :encoding =&gt; 'ascii-8bit')
  file.write StringIO.new(attachment.body.decoded).read
  excel = Roo::Excel.new(file.path)
  </code></pre>
  
  <p>But it involves writing a temporary file to the file system which I would like to get rid of.</p>
  
  <p>Is there a way to create a virtual file?</p>