module SeeAsVee::Helpers::Privates
Constants
- FILE_TYPE
Public Class Methods
csv_to_array(path)
click to toggle source
# File lib/see_as_vee/helpers.rb, line 55 def csv_to_array path CSV.read path end
handler_by_ext(ext)
click to toggle source
# File lib/see_as_vee/helpers.rb, line 46 def handler_by_ext ext ext.to_sym if %w(xlsx csv).include?(ext) end
handler_name(file_type)
click to toggle source
# File lib/see_as_vee/helpers.rb, line 41 def handler_name file_type (FILE_TYPE.detect { |k, _| k =~ file_type } || []).last end
tempfile(bytes)
click to toggle source
# File lib/see_as_vee/helpers.rb, line 36 def tempfile bytes Tempfile.new(['see_as_vee', '.csv']).tap { |f| f.syswrite(bytes) if bytes } end
xlsx_to_array(path)
click to toggle source
# File lib/see_as_vee/helpers.rb, line 51 def xlsx_to_array path SimpleXlsxReader.open(path).sheets.first.rows end
Private Instance Methods
csv_to_array(path)
click to toggle source
# File lib/see_as_vee/helpers.rb, line 55 def csv_to_array path CSV.read path end
handler_by_ext(ext)
click to toggle source
# File lib/see_as_vee/helpers.rb, line 46 def handler_by_ext ext ext.to_sym if %w(xlsx csv).include?(ext) end
handler_name(file_type)
click to toggle source
# File lib/see_as_vee/helpers.rb, line 41 def handler_name file_type (FILE_TYPE.detect { |k, _| k =~ file_type } || []).last end
tempfile(bytes)
click to toggle source
# File lib/see_as_vee/helpers.rb, line 36 def tempfile bytes Tempfile.new(['see_as_vee', '.csv']).tap { |f| f.syswrite(bytes) if bytes } end
xlsx_to_array(path)
click to toggle source
# File lib/see_as_vee/helpers.rb, line 51 def xlsx_to_array path SimpleXlsxReader.open(path).sheets.first.rows end