Package pypat :: Package behavioral :: Module command :: Class Invoker
[hide private]
[frames] | no frames]

Class Invoker

source code


Abstract Invoker class as part of the Command pattern.

- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
- External Command Pattern documentation: U{https://en.wikipedia.org/wiki/Command_pattern}

Instance Methods [hide private]
 
__init__(self, valid_commands)
Initialize a new Invoker instance.
source code
 
execute(self, command)
Execute a command.
source code
 
undo(self)
Undo the last command.
source code
Method Details [hide private]

__init__(self, valid_commands)
(Constructor)

source code 

Initialize a new Invoker instance.

Parameters:
  • valid_commands - A list of command classes this invoker can handle.

execute(self, command)

source code 

Execute a command.

Parameters:
  • command (Command) - A command for the invoker to execute.