lib/aggregates/message_processor.rb
# Provides a single mapping of Message Classes to a list of handler
# blocks that should be executed when that type of message is received.
Provides a single mapping of Message Classes to a list of handler
blocks that should be executed when that type of message is received.
Provides a single mapping of Message Classes to a list of handler blocks that should be executed when that type of message is received .
def with_message_handlers(message, &block)
      search_class = message.class
      while search_class != DomainMessage
        handlers = self.class.message_mapping[search_class]
        handlers&.each(&block)
        search_class = search_class.superclass
      end
    end
def with_message_handlers ( message , & block ) search_class = message . class while search_class != DomainMessage handlers = self . class . message_mapping [ search_class ] handlers &. each ( & block ) search_class = search_class . superclass end end
Provides a single mapping of Message Classes to a list of handler
blocks that should be executed when that type of message is received.
Provides a single mapping of Message Classes to a list of handler blocks that should be executed when that type of message is received .
message
<not_specific>
block
<not_specific>