Class: Plux::Server
- Inherits:
-
Object
- Object
- Plux::Server
- Defined in:
- lib/plux/server.rb
Constant Summary collapse
- Active =
{}
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
Instance Method Summary collapse
- #boot(block) ⇒ Object
- #close ⇒ Object
- #connect ⇒ Object
-
#initialize(name, thread:) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(name, thread:) ⇒ Server
Returns a new instance of Server.
12 13 14 15 |
# File 'lib/plux/server.rb', line 12 def initialize(name, thread: ) @name = name @thread = thread end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/plux/server.rb', line 7 def name @name end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
7 8 9 |
# File 'lib/plux/server.rb', line 7 def pid @pid end |
Instance Method Details
#boot(block) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/plux/server.rb', line 17 def boot(block) Plux.lock_pid_file(name) do |file| start_server_if_not_pid(file, block) end self end |
#close ⇒ Object
24 25 26 |
# File 'lib/plux/server.rb', line 24 def close Process.kill('TERM', pid) rescue Errno::ESRCH end |