lib/to_xls.rb in to_xls-0.0.3 vs lib/to_xls.rb in to_xls-0.1.0
- old
+ new
@@ -1,7 +1,8 @@
require 'rubygems'
require 'spreadsheet'
+require 'stringio'
class Array
# Options for to_xls: columns, name, header
def to_xls(options = {})
@@ -32,9 +33,15 @@
end
end
end
return book
+ end
+
+ def to_xls_data(options = {})
+ data = StringIO.new('')
+ self.to_xls(options).write(data)
+ return data.string
end
private
def aux_to_xls(item, column, row)
if column.is_a?(String) or column.is_a?(Symbol)