Method: TableImporter::Source#initialize

Defined in:
lib/table_importer/source.rb

#initialize(data) ⇒ Source

Returns a new instance of Source.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/table_importer/source.rb', line 14

def initialize (data)
  case data[:type]
  when 'copy_and_paste'
    @source = CopyAndPaste.new(data)
  when 'csv'
    @source = CSV.new(data)
  when 'xls', 'xlsx'
    @source = Excel.new(data)
  when 'google'
    @source = Google.new(data)
  else
    raise TableImporter::IncorrectFileError.new
  end
  @source
end