lib/roo/xls/excel_2003_xml.rb in roo-xls-1.0.0 vs lib/roo/xls/excel_2003_xml.rb in roo-xls-1.1.0
- old
+ new
@@ -1,24 +1,25 @@
require 'date'
require 'base64'
require 'nokogiri'
+require 'tmpdir'
class Roo::Excel2003XML < Roo::Base
# initialization and opening of a spreadsheet file
# values for packed: :zip
def initialize(filename, options = {})
packed = options[:packed]
file_warning = options[:file_warning] || :error
- make_tmpdir do |tmpdir|
+ Dir.mktmpdir do |tmpdir|
filename = download_uri(filename, tmpdir) if uri?(filename)
filename = unzip(filename, tmpdir) if packed == :zip
file_type_check(filename, '.xml', 'an Excel 2003 XML', file_warning)
@filename = filename
unless File.file?(@filename)
- fail IOError, "file #{@filename} does not exist"
+ raise IOError, "file #{@filename} does not exist"
end
@doc = ::Roo::Utils.load_xml(@filename)
end
namespace = @doc.namespaces.select{|xmlns, urn| urn == 'urn:schemas-microsoft-com:office:spreadsheet'}.keys.last
@namespace = (namespace.nil? || namespace.empty?) ? 'ss' : namespace.split(':').last
@@ -238,10 +239,10 @@
row += 1
col = 1
end
end
unless sheet_found
- fail RangeError, "Unable to find sheet #{sheet} for reading"
+ raise RangeError, "Unable to find sheet #{sheet} for reading"
end
@cells_read[sheet] = true
end
def read_styles