Class: Codebot::IPCClient
- Inherits:
-
Object
- Object
- Codebot::IPCClient
- Defined in:
- lib/codebot/ipc_client.rb
Overview
A pipe-based IPC client used for communicating with a running Codebot instance.
Instance Attribute Summary collapse
-
#pipe ⇒ String
readonly
The path to the named pipe.
Instance Method Summary collapse
-
#initialize(pipe = nil) ⇒ IPCClient
constructor
Creates a new IPC client.
-
#pipe_exist? ⇒ Boolean
Checks whether the named pipe exists.
-
#send_rehash(explicit = true) ⇒ Object
Sends a REHASH command to the named pipe.
-
#send_stop(explicit = true) ⇒ Object
Sends a STOP command to the named pipe.
Constructor Details
#initialize(pipe = nil) ⇒ IPCClient
Creates a new IPC client.
16 17 18 |
# File 'lib/codebot/ipc_client.rb', line 16 def initialize(pipe = nil) @pipe = pipe || IPCServer.default_pipe end |
Instance Attribute Details
#pipe ⇒ String (readonly)
Returns the path to the named pipe.
10 11 12 |
# File 'lib/codebot/ipc_client.rb', line 10 def pipe @pipe end |
Instance Method Details
#pipe_exist? ⇒ Boolean
Checks whether the named pipe exists.
37 38 39 |
# File 'lib/codebot/ipc_client.rb', line 37 def pipe_exist? File.pipe? @pipe end |
#send_rehash(explicit = true) ⇒ Object
Sends a REHASH command to the named pipe.
23 24 25 |
# File 'lib/codebot/ipc_client.rb', line 23 def send_rehash(explicit = true) command('REHASH', explicit) end |
#send_stop(explicit = true) ⇒ Object
Sends a STOP command to the named pipe.
30 31 32 |
# File 'lib/codebot/ipc_client.rb', line 30 def send_stop(explicit = true) command('STOP', explicit) end |