module Plux

Constants

VERSION

Public Class Methods

dir() click to toggle source
# File lib/plux.rb, line 13
def dir
  File.join(Dir.home, '.plux')
end
lock_pid_file(name) { |file| ... } click to toggle source
# File lib/plux.rb, line 21
def lock_pid_file(name)
  File.open(pid_file(name), File::RDWR|File::CREAT, 0644) do |file|
    begin
      file.flock(File::LOCK_EX)
      yield file
    ensure
      file.flock(File::LOCK_UN)
    end
  end
end
pid_file(server_name) click to toggle source
# File lib/plux.rb, line 17
def pid_file(server_name)
  File.join(dir, "#{server_name}.pid")
end
server_file(server_name) click to toggle source
# File lib/plux.rb, line 32
def server_file(server_name)
  File.join(dir, "#{server_name}.so")
end
worker(name, thread: 1, &block) click to toggle source
# File lib/plux.rb, line 36
def worker(name, thread: 1, &block)
  worker = Class.new(&block).new
  Server.new(name, thread: thread).boot(worker)
end