Class: Grid::CommandHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/grid/command_handler.rb

Instance Method Summary collapse

Instance Method Details

#on_command(command) ⇒ Object



8
9
10
# File 'lib/grid/command_handler.rb', line 8

def on_command(command)
  @handlers[command.name].call(command.params)
end

#register_command(name, &block) ⇒ Object



3
4
5
6
# File 'lib/grid/command_handler.rb', line 3

def register_command(name, &block)
  @handlers ||= {}
  @handlers[name] = block
end