module Eyecare
Constants
- VERSION
Attributes
config_path[R]
Public Class Methods
alert()
click to toggle source
# File lib/eyecare.rb, line 58 def alert Alert.instance.init(config[:alert]) end
config()
click to toggle source
# File lib/eyecare.rb, line 62 def config return @config if @config config_file = File.expand_path(config_path) if File.exists?(config_file) && File.file?(config_file) && File.readable?(config_file) @config = Config.load_from_file(config_file) end @config ||= Config.new end
run()
click to toggle source
# File lib/eyecare.rb, line 40 def run Daemon.start(config[:pid_file]) do while true seconds = config[:alert][:interval] while seconds > 0 proc_name('Eyecare - %s' % ChronicDuration.output(seconds, :format => :short)) seconds -= 1 sleep(1) end alert.show end end end
stop()
click to toggle source
# File lib/eyecare.rb, line 54 def stop Daemon.stop(config[:pid_file]) end
Private Class Methods
proc_name(name)
click to toggle source
# File lib/eyecare.rb, line 75 def proc_name(name) $0 = name return false unless self.respond_to?(:prctl) name = name.slice(0, 16) ptr = FFI::MemoryPointer.from_string(name) self.prctl(15, ptr.address, 0, 0) ensure ptr.free if ptr end