Module: ActiveDelivery::Callbacks

Extended by:
ActiveSupport::Concern
Includes:
ActiveSupport::Callbacks
Included in:
Base
Defined in:
lib/active_delivery/callbacks.rb

Overview

Add callbacks support to Active Delivery (requires ActiveSupport::Callbacks)

# Run method before delivering notification
# NOTE: when `false` is returned the executation is halted
before_notify :do_something

# You can specify a notification method (to run callback only for that method)
before_notify :do_mail_something, on: :mail

# or for push notifications
before_notify :do_mail_something, on: :push

# after_ and around_ callbacks are also supported
after_notify :cleanup

around_notify :set_context

Defined Under Namespace

Modules: InstanceExt, SingltonExt

Constant Summary collapse

CALLBACK_TERMINATOR =
if ::ActiveSupport::VERSION::MAJOR >= 5
  ->(_target, result) { result.call == false }
else
  ->(_target, result) { result == false }
end