Class: Officer::Command::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/officer/commands.rb

Constant Summary collapse

@@commands =

command_name => klass

{}

Class Method Summary collapse

Class Method Details

.create(line, connection) ⇒ Object



8
9
10
11
# File 'lib/officer/commands.rb', line 8

def create line, connection
  request = JSON.parse line
  @@commands[request['command']].new connection, request
end

.register(command_name, klass) ⇒ Object



13
14
15
# File 'lib/officer/commands.rb', line 13

def register command_name, klass
  @@commands[command_name] = klass
end