Class: Invoker::IPC::BaseCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/invoker/ipc/base_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_socket) ⇒ BaseCommand

Returns a new instance of BaseCommand.



5
6
7
# File 'lib/invoker/ipc/base_command.rb', line 5

def initialize(client_socket)
  @client_socket = client_socket
end

Instance Attribute Details

#client_socketObject

Returns the value of attribute client_socket.



4
5
6
# File 'lib/invoker/ipc/base_command.rb', line 4

def client_socket
  @client_socket
end

Instance Method Details

#run_command(message_object) ⇒ Boolean

Invoke the command that actual processes incoming message returning true from this message means, command has been processed and client socket can be closed. returning false means, it is a long running command and socket should not be closed immediately

Parameters:

Returns:

  • (Boolean)

    true or false



19
20
21
# File 'lib/invoker/ipc/base_command.rb', line 19

def run_command(message_object)
  raise "Not implemented"
end

#send_data(message_object) ⇒ Object



9
10
11
# File 'lib/invoker/ipc/base_command.rb', line 9

def send_data(message_object)
  client_socket.write(message_object.encoded_message)
end