Class: Tomate::Timer
- Inherits:
-
Object
- Object
- Tomate::Timer
- Defined in:
- lib/tomate/timer.rb
Constant Summary collapse
- DEFAULT_DELAY =
25*60
Instance Method Summary collapse
-
#initialize(delay = nil) ⇒ Timer
constructor
A new instance of Timer.
- #start ⇒ Object
Constructor Details
#initialize(delay = nil) ⇒ Timer
Returns a new instance of Timer.
5 6 7 |
# File 'lib/tomate/timer.rb', line 5 def initialize(delay = nil) @delay = Integer(delay || DEFAULT_DELAY) end |
Instance Method Details
#start ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/tomate/timer.rb', line 9 def start fork_only! fork do system('notify-send', '-i', 'Pomodoro', "Timer started: #{@delay} seconds.") sleep @delay system('notify-send', '-u', 'critical', '-t', '60000', '-i', 'Pomodoro', 'Take a break, nerd!') end end |