Module: TCB::HandlesCommands::ClassMethods
- Defined in:
- lib/tcb/handles_commands.rb
Instance Method Summary collapse
- #command_handler_registrations ⇒ Object
- #handle(command_class, handler) ⇒ Object
- #with(*handlers) ⇒ Object
Instance Method Details
#command_handler_registrations ⇒ Object
26 27 28 |
# File 'lib/tcb/handles_commands.rb', line 26 def command_handler_registrations @command_handler_registrations end |
#handle(command_class, handler) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/tcb/handles_commands.rb', line 13 def handle(command_class, handler) @command_handler_registrations << CommandHandlerRegistration.new( command_class: command_class, handler: handler ) end |
#with(*handlers) ⇒ Object
20 21 22 23 24 |
# File 'lib/tcb/handles_commands.rb', line 20 def with(*handlers) raise ArgumentError, "command accepts exactly one handler" unless handlers.compact.size == 1 handlers.first end |