module TimeAlert

Constants

VERSION

Public Class Methods

alert(minutes) click to toggle source

Your code goes here…

# File lib/time_alert.rb, line 9
def self.alert(minutes)
  file_path = "/tmp/stop_alert"
  FileUtils.touch file_path
  Daemons.daemonize
  sleep minutes*60
  i = 0;
  while(File.exist? file_path) do
    #`say "bang bang bang"`
    system("say", "bang bang bang")

    sleep 0.5
    i += 1
    break if i > 100
  end
end
stop() click to toggle source
# File lib/time_alert.rb, line 25
def self.stop
  begin
    File.delete "/tmp/stop_alert"
  rescue Errno::ENOENT => e
  end

end