Class: Nuntius::MessengerJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- Nuntius::MessengerJob
- Defined in:
- app/jobs/nuntius/messenger_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(obj, event, params = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/jobs/nuntius/messenger_job.rb', line 6 def perform(obj, event, params = {}) return unless obj ActiveRecord::Base.transaction do messenger = Nuntius::BaseMessenger.messenger_for_obj(obj).new(obj, event, params) return unless messenger.is_a?(Nuntius::CustomMessenger) || messenger.respond_to?(event.to_sym) result = messenger.call return if result == false templates = messenger.templates messenger.dispatch(templates) if templates.exists? end end |