Module: Plux
- Defined in:
- lib/plux.rb,
lib/plux/client.rb,
lib/plux/parser.rb,
lib/plux/server.rb,
lib/plux/version.rb,
lib/plux/reactors.rb
Defined Under Namespace
Classes: Client, Parser, Reactors, Server
Constant Summary
collapse
- VERSION =
"0.1.4"
Class Method Summary
collapse
Class Method Details
.dir ⇒ Object
12
13
14
|
# File 'lib/plux.rb', line 12
def dir
File.join(Dir.home, '.plux')
end
|
.lock_pid_file(name) ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/plux.rb', line 20
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) ⇒ Object
16
17
18
|
# File 'lib/plux.rb', line 16
def pid_file(server_name)
File.join(dir, "#{server_name}.pid")
end
|
.server_file(server_name) ⇒ Object
31
32
33
|
# File 'lib/plux.rb', line 31
def server_file(server_name)
File.join(dir, "#{server_name}.so")
end
|
.worker(name, thread: 1, &block) ⇒ Object
35
36
37
|
# File 'lib/plux.rb', line 35
def worker(name, thread: 1, &block)
Server.new(name, thread: thread).boot(block)
end
|