Module: Primadoro

Defined in:
lib/primadoro.rb

Defined Under Namespace

Modules: Views

Class Method Summary collapse

Class Method Details

.action(action_taken) ⇒ Object



20
21
22
23
24
25
# File 'lib/primadoro.rb', line 20

def action(action_taken)
  puts "#{action_taken} at #{Time.now.strftime('%D %T')}"
        
  @views.each {|v| v.send(action_taken)}
  sleep(@actions[action_taken] * 60)
end

.runObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/primadoro.rb', line 3

def run    
  # TODO: Make each of these configurable
  @views = [
    Views::Tunes.new,
    Views::Growl.new,
    Views::Sound.new
  ]
  
  @actions = {:break_time => 5, :pomodoro => 25}
  
  while(true)
    # TODO: Add action hooks later
    action(:pomodoro)
    action(:break_time)
  end
end