Module: CobraCommander::CommandBus
- Defined in:
- lib/cobracommander/command_bus.rb
Instance Method Summary collapse
-
#execute(command) ⇒ Object
Mixed.
-
#unexecute(command) ⇒ Object
Mixed.
Instance Method Details
#execute(command) ⇒ Object
Returns mixed.
6 7 8 9 10 11 12 |
# File 'lib/cobracommander/command_bus.rb', line 6 def execute(command) command.expose.each do |cmd| handler = CobraCommander::CommandTranslator.map_to_handler(cmd) @handler = handler.new return @handler.handle(cmd) end end |
#unexecute(command) ⇒ Object
Returns mixed.
16 17 18 19 20 21 22 |
# File 'lib/cobracommander/command_bus.rb', line 16 def unexecute(command) command.expose.each do |cmd| handler = CobraCommander::CommandTranslator.map_to_handler(cmd) @handler = handler.new return @handler.unhandle(cmd) end end |