Class: Invoker::IPC::UnixClient
- Inherits:
-
Object
- Object
- Invoker::IPC::UnixClient
- Defined in:
- lib/invoker/ipc/unix_client.rb
Class Method Summary collapse
Instance Method Summary collapse
- #send_and_receive(command, message = {}) ⇒ Object
- #send_and_wait(command, message = {}) ⇒ Object
- #send_command(command, message = {}) ⇒ Object
Class Method Details
.send_command(command, message_arguments = {}, &block) ⇒ Object
39 40 41 |
# File 'lib/invoker/ipc/unix_client.rb', line 39 def self.send_command(command, = {}, &block) new.send_command(command, , &block) end |
Instance Method Details
#send_and_receive(command, message = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/invoker/ipc/unix_client.rb', line 16 def send_and_receive(command, = {}) response = nil = (command, ) open_client_socket(false) do |socket| (socket, ) socket.flush response = Invoker::IPC.(socket) end response end |
#send_and_wait(command, message = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/invoker/ipc/unix_client.rb', line 27 def send_and_wait(command, = {}) begin socket = Socket.unix(Invoker::IPC::Server::SOCKET_PATH) rescue abort("Invoker does not seem to be running".color(:red)) end = (command, ) (socket, ) socket.flush socket end |
#send_command(command, message = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/invoker/ipc/unix_client.rb', line 4 def send_command(command, = {}) = (command, ) open_client_socket do |socket| (socket, ) socket.flush if block_given? response_object = Invoker::IPC.(socket) yield response_object end end end |