-
Notifications
You must be signed in to change notification settings - Fork 21.4k
/
callbacks.rb
31 lines (26 loc) · 915 Bytes
/
callbacks.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true
module ActionMailer
module Callbacks
extend ActiveSupport::Concern
included do
include ActiveSupport::Callbacks
define_callbacks :deliver, skip_after_callbacks_if_terminated: true
end
module ClassMethods
# Defines a callback that will get called right before the
# message is sent to the delivery method.
def before_deliver(*filters, &blk)
set_callback(:deliver, :before, *filters, &blk)
end
# Defines a callback that will get called right after the
# message's delivery method is finished.
def after_deliver(*filters, &blk)
set_callback(:deliver, :after, *filters, &blk)
end
# Defines a callback that will get called around the message's deliver method.
def around_deliver(*filters, &blk)
set_callback(:deliver, :around, *filters, &blk)
end
end
end
end