class Tomate::Timer
Constants
- DEFAULT_DELAY
Public Class Methods
new(delay = nil)
click to toggle source
# File lib/tomate/timer.rb, line 5 def initialize(delay = nil) @delay = Integer(delay || DEFAULT_DELAY) end
Public Instance Methods
start()
click to toggle source
# 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
Private Instance Methods
fork_only!()
click to toggle source
# File lib/tomate/timer.rb, line 21 def fork_only! fail 'Your operating system does not support forking.' unless Process.respond_to?(:fork) end