Class: Tyme::Manager

Inherits:
Object
  • Object
show all
Defined in:
lib/tyme/manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(db_path = nil, last_output = nil) ⇒ Manager

Returns a new instance of Manager.



6
7
8
9
# File 'lib/tyme/manager.rb', line 6

def initialize( db_path = nil, last_output = nil )
  @db = db_path ? Db.new(db_path) : Db.new
  @last = last_output ? Last.new(last_output) : Last.new
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
# File 'lib/tyme/manager.rb', line 11

def run
  @last.process.each do |user, value|
    value.each do |date, duration|
      @db.add_entry( user, date, duration )
    end
  end
  @db.save
end