Class: RailsTransactionalOutbox::ReliableModel::ReliableCallback

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_transactional_outbox/reliable_model/reliable_callback.rb

Instance Method Summary collapse

Constructor Details

#initialize(callback, options) ⇒ ReliableCallback

Returns a new instance of ReliableCallback.



9
10
11
12
# File 'lib/rails_transactional_outbox/reliable_model/reliable_callback.rb', line 9

def initialize(callback, options)
  @callback = callback
  @options = options
end

Instance Method Details

#call(model) ⇒ Object



18
19
20
21
22
# File 'lib/rails_transactional_outbox/reliable_model/reliable_callback.rb', line 18

def call(model)
  return unless execute?(model)

  model.instance_exec(&callback)
end

#for_event?(event_type) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/rails_transactional_outbox/reliable_model/reliable_callback.rb', line 14

def for_event?(event_type)
  on.include?(event_type.to_sym)
end