Class: CobraCommander::CommandHandler

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

Overview

Abstract

Instance Method Summary collapse

Instance Method Details

#handle(command) ⇒ Object

NOTE: If you need validation, implement it in this method in the Child CommandHandler

Parameters:

  • Command

Returns:

  • mixed



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

def handle(command)
  command.execute
end

#unhandle(command) ⇒ Object

Returns mixed.

Parameters:

  • Command

Returns:

  • mixed



14
15
16
# File 'lib/cobracommander/command_handler.rb', line 14

def unhandle(command)
  command.unexecute
end

#validate(*args) ⇒ Object

NOTE: Leaving this in until I can figure out a more sensible way to validate arguments

If this stays, I plan to call validate(command).execute() within the handle() method in order to provide validation without having to overwrite handle()


20
21
22
# File 'lib/cobracommander/command_handler.rb', line 20

def validate(*args)

end