Class: PredictabilityEngine::DataSources::Excel

Inherits:
Base
  • Object
show all
Defined in:
lib/predictability_engine/data_sources/excel.rb

Instance Method Summary collapse

Methods inherited from Base

#configure, #load

Instance Method Details

#perform_load(path) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/predictability_engine/data_sources/excel.rb', line 8

def perform_load(path)
  return build_work_items(mock_data('MOCK_EXCEL_DATA')) if ENV['MOCK_EXCEL_DATA']

  xlsx = Roo::Spreadsheet.open(path)
  iterator = xlsx.sheet(0).each(id: 'id', start_date: 'start_date', end_date: 'end_date')
                 .reject { |row| row[:id] == 'id' }
  load_data(iterator)
end