Module: Pomodoro

Defined in:
lib/pomodoro.rb,
lib/pomodoro/version.rb

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.break_growlObject



30
31
32
# File 'lib/pomodoro.rb', line 30

def break_growl
  system 'growlnotify -w -n Pomodoro -m "You have 5 minutes." "BREAK TIME"'
end

.start!Object



8
9
10
11
12
13
# File 'lib/pomodoro.rb', line 8

def start!
  Noprocrast.activate!
  @start_time = Time.now
  work_growl
  @stopped = false
end

.stop!Object



14
15
16
17
18
# File 'lib/pomodoro.rb', line 14

def stop!
  Noprocrast.deactivate!
  break_growl
  @stopped = true
end

.workObject



20
21
22
23
24
25
26
27
28
# File 'lib/pomodoro.rb', line 20

def work
  @start_time = Time.now if @start_time.nil?
  elapsed_time = Time.now - @start_time
  if elapsed_time >= 1800 && @stopped == true # 30 minutes * 60 seconds
    start!
  elsif elapsed_time >= 1500 && @stopped == false # 25 minutes * 60 seconds
    stop!
  end
end

.work_growlObject



34
35
36
# File 'lib/pomodoro.rb', line 34

def work_growl
  system 'growlnotify -w -n Pomodoro -m "This lasts 25 minutes." "WORK TIME"'
end