ruby-roo

Is there any way to get Roo to accept StringIO objects in place of files?

跟風遠走 提交于 2019-12-23 13:10:55
问题 I'm trying to write some unit tests which involves Roo reading Excel 2007 files. I have the Excel file in my unit test file as a hex string, which in turn is fed into a StringIO instance. I can't simply pass the StringIO object to Roo::Spreadsheet.open , since that function actually checks if the passed object is a File instance: def open(file, options = {}) file = File === file ? file.path : file # ... and if it isn't, proceeds to assume it's a string. Manually specifying the extension doesn