Sha256: e590f4e8776ba4cc4df745cd218f74265f27c9c896b5d0f3314ec84ceb1ac849
Contents?: true
Size: 1015 Bytes
Versions: 2
Compression:
Stored size: 1015 Bytes
Contents
module Invoker module CommandListener class Client attr_accessor :client_socket def initialize(client_socket) @client_socket = client_socket end def read_and_execute command_info = client_socket.read() if command_info && !command_info.empty? worker_command, command_label, rest_args = command_info.strip.split(" ") if worker_command && command_label run_command(worker_command, command_label, rest_args) end end client_socket.close() end def run_command(worker_command, command_label, rest_args = nil) case worker_command when 'add' Invoker::COMMANDER.add_command_by_label(command_label) when 'remove' Invoker::COMMANDER.remove_command(command_label, rest_args) when 'reload' Invoker::COMMANDER.reload_command(command_label) else $stdout.puts("\n Invalid command".red) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
invoker-0.0.3 | lib/invoker/command_listener/client.rb |
invoker-0.0.2 | lib/invoker/command_listener/client.rb |