Class: Hbtrack::Importer::StreaksImporter

Inherits:
AbstractImporter show all
Defined in:
lib/hbtrack/importer/streaks_importer.rb

Constant Summary collapse

Habit =
Hbtrack::Database::Habit
Entry =
Hbtrack::Database::Entry

Instance Method Summary collapse

Methods inherited from AbstractImporter

#initialize, #store_in

Constructor Details

This class inherits a constructor from Hbtrack::Importer::AbstractImporter

Instance Method Details

#import_from(file) ⇒ Object

Import and parse the CSV from Streaks



14
15
16
17
18
19
20
21
# File 'lib/hbtrack/importer/streaks_importer.rb', line 14

def import_from(file)
  raise 'File not found' unless File.exist?(file)
  CSV.foreach(file, headers: true) do |row|
    extract_streaks_data(row)
  end
  # Handle the parsed data
  [@habits, @entries]
end