class FireAndForget::Server
Public Class Methods
get_pid(task)
click to toggle source
# File lib/fire_and_forget/server.rb, line 30 def self.get_pid(task) pids[task.name] end
kill(task_name, signal="TERM")
click to toggle source
# File lib/fire_and_forget/server.rb, line 17 def self.kill(task_name, signal="TERM") pid = pids[task_name] Process.kill(signal, pid) unless pid == 0 end
parse(command_string)
click to toggle source
# File lib/fire_and_forget/server.rb, line 4 def self.parse(command_string) command = Command.load(command_string) [command, run(command)] end
pids()
click to toggle source
# File lib/fire_and_forget/server.rb, line 34 def self.pids @pids ||= {} end
run(cmd)
click to toggle source
# File lib/fire_and_forget/server.rb, line 9 def self.run(cmd) if Command.allowed?(cmd) cmd.run else raise PermissionsError, "'#{cmd.class}' is not an approved command" end end
set_pid(task_name, pid)
click to toggle source
# File lib/fire_and_forget/server.rb, line 26 def self.set_pid(task_name, pid) pids[task_name] = pid.to_i end
status()
click to toggle source
# File lib/fire_and_forget/server.rb, line 22 def self.status @status ||= {} end