Class: FeatureChannel::Subscriber::MessageProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_channel/subscriber/message_processor.rb

Constant Summary collapse

OPERATIONS =
{
  'CREATE' => :create_entity,
  'UPDATE' => :update_entity,
  'DELETE' => :delete_entity
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(message:, model:) ⇒ MessageProcessor

Returns a new instance of MessageProcessor.



12
13
14
15
# File 'lib/feature_channel/subscriber/message_processor.rb', line 12

def initialize(message:, model:)
  @model = model
  @message = message
end

Instance Method Details

#run!Object



17
18
19
# File 'lib/feature_channel/subscriber/message_processor.rb', line 17

def run!
  method(operation_callback).call(model: @model, params: entity_params)
end