class Hbtrack::Importer::AbstractImporter

Public Class Methods

new() click to toggle source
# File lib/hbtrack/importer/abstract_importer.rb, line 7
def initialize
  @habits = {}
  @entries = {}
end

Public Instance Methods

import_from(file) click to toggle source

Import and parse the CSV from Streaks

# File lib/hbtrack/importer/abstract_importer.rb, line 28
def import_from(file)
  raise 'Not implemented'
end
store_in(store) click to toggle source

Store in database

# File lib/hbtrack/importer/abstract_importer.rb, line 13
def store_in(store)
  ids = {}
  @habits.each do |id, habit|
    ids[id] = store.add_habit(habit)
  end

  @entries.each do |key, entries|
    id = ids[key]
    entries.each do |entry|
      store.add_entry_of(id, entry)
    end
  end
end