aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_mailbox/callbacks.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_mailbox/callbacks.rb')
-rw-r--r--lib/action_mailbox/callbacks.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/action_mailbox/callbacks.rb b/lib/action_mailbox/callbacks.rb
new file mode 100644
index 0000000000..33caaafd2a
--- /dev/null
+++ b/lib/action_mailbox/callbacks.rb
@@ -0,0 +1,26 @@
+require "active_support/callbacks"
+
+module ActionMailbox
+ module Callbacks
+ extend ActiveSupport::Concern
+ include ActiveSupport::Callbacks
+
+ included do
+ define_callbacks :process
+ end
+
+ module ClassMethods
+ def before_processing(*methods, &block)
+ set_callback(:process, :before, *methods, &block)
+ end
+
+ def after_processing(*methods, &block)
+ set_callback(:process, :after, *methods, &block)
+ end
+
+ def around_processing(*methods, &block)
+ set_callback(:process, :around, *methods, &block)
+ end
+ end
+ end
+end