Class: Domodoro::Channel
- Inherits:
-
EM::Channel
- Object
- EM::Channel
- Domodoro::Channel
- Defined in:
- lib/domodoro/channel.rb
Instance Method Summary collapse
Instance Method Details
#afternoon(min) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/domodoro/channel.rb', line 33 def afternoon(min) case min when 20, 50 puts "#{Time.now} - Starting pomodoro!" self << :start when 45, 15 puts "#{Time.now} - Pomodoro break!" self << :stop end end |
#broadcast(hour, min) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/domodoro/channel.rb', line 3 def broadcast(hour, min) if ENV['DEBUG'] puts 'DEBUG MODE: Start on even minutes, stop on odd minutes' if min % 2 == 0 puts "#{Time.now} - Starting pomodoro!" self << :start else puts "#{Time.now} - Pomodoro break!" self << :stop end return end if (hour >= 8 && hour < 13) morning(min) elsif (hour >= 13 && min >= 20) && afternoon(min) end end |
#morning(min) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/domodoro/channel.rb', line 22 def morning(min) case min when 0, 30 puts "#{Time.now} - Starting pomodoro!" self << :start when 25, 55 puts "#{Time.now} - Pomodoro break!" self << :stop end end |