class Object
Constants
- SOCKET_FILE
Public Instance Methods
already_running?()
click to toggle source
# File lib/helper.rb, line 18 def already_running? File.socket?(SOCKET_FILE) end
asset(file)
click to toggle source
# File lib/helper.rb, line 3 def asset file File.join(File.dirname(__FILE__), '../assets/' + file) end
daemon()
click to toggle source
# File lib/helper.rb, line 37 def daemon puts "Running as daemon" Process.daemon(true, false) end
quit()
click to toggle source
# File lib/helper.rb, line 32 def quit puts 'Terminated via socket' exit end
read_config()
click to toggle source
# File lib/helper.rb, line 28 def read_config Alarm.new($config[:alarm]) if $config[:alarm] end
send_message()
click to toggle source
# File lib/helper.rb, line 22 def send_message client = UNIXSocket.open SOCKET_FILE client.print ARGV.to_yaml client.close end
symbolise(hash)
click to toggle source
# File lib/helper.rb, line 7 def symbolise hash hash.keys.each do |key| hash[key.to_sym] = hash[key] hash.delete(key) if hash[key.to_sym].is_a?(Hash) symbolise hash[key.to_sym] end end return hash end