Class: Pheromone::Messaging::MessageDispatcher
- Inherits:
-
Object
- Object
- Pheromone::Messaging::MessageDispatcher
- Defined in:
- lib/pheromone/messaging/message_dispatcher.rb
Defined Under Namespace
Classes: NoSpecifiedProcessor
Instance Method Summary collapse
- #dispatch ⇒ Object
-
#initialize(message_parameters:, dispatch_method:) ⇒ MessageDispatcher
constructor
A new instance of MessageDispatcher.
Constructor Details
#initialize(message_parameters:, dispatch_method:) ⇒ MessageDispatcher
Returns a new instance of MessageDispatcher.
14 15 16 17 |
# File 'lib/pheromone/messaging/message_dispatcher.rb', line 14 def initialize(message_parameters:, dispatch_method:) @message_parameters = @dispatch_method = dispatch_method end |
Instance Method Details
#dispatch ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pheromone/messaging/message_dispatcher.rb', line 19 def dispatch return unless Pheromone.enabled? if @dispatch_method == :sync Message.new( .merge!( encoder: @message_parameters[:encoder], message_format: @message_parameters[:message_format] ) ).send! elsif @dispatch_method == :async end end |