lib/rbbt/util/excel2tsv.rb in rbbt-util-5.21.56 vs lib/rbbt/util/excel2tsv.rb in rbbt-util-5.21.57

- old
+ new

@@ -1,33 +1,2 @@ -require 'spreadsheet' -require 'rbbt/tsv' -require 'rbbt/util/tmpfile' - -module TSV - def self.excel2tsv(file, options = {}) - sheet = options.delete :sheet - header = options.delete :header - header = true unless header == false - sheet ||= 0 - TmpFile.with_file do |filename| - workbook = Spreadsheet.open Open.open(file) - sheet = workbook.worksheet sheet - - rows = [] - - sheet.each do |row| - rows << row.values_at(0..(row.size - 1)) - end - - File.open(filename, 'w') do |f| - if header - header = rows.shift - f.puts "#" + header * "\t" - end - - rows.each do |row| f.puts row * "\t" end - end - - TSV.open(filename, options) - end - end -end +Log.warn "File #{__FILE__} is deprecated, please require 'rbbt/tsv/excel' instead" +require 'rbbt/tsv/excel'