Method: LoaderFactory.load

Defined in:
lib/loader_factory.rb

.load(file, opts) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/loader_factory.rb', line 6

def self.load(file, opts)
  opts ||= { }
  mx = []
  if(file =~ /\.xls$/)
	mx = LoaderXls.makeMatrix(file, opts)
elsif(@file =~ /(\.tsv|\.txt|\.TSV|\.TXT)/)
	mx = LoaderTxt.makeMatrix(file, opts)
elsif(file =~ /(\.csv|\.CSV)/)
    opts[:sep] = ','
    mx = LoaderTxt.makeMatrix(file, opts)
elsif(file == nil)
else
	#デフォルトはTSVで読み込むようにする。
	mx = LoaderTxt.makeMatrix(file, opts)
end
  mx = self.clean(mx)
  return mx
end