Sha256: f7e811facaf1750cf23a2d609f7dbcc61176636071a30fb5790a843d3551e1c9

Contents?: true

Size: 869 Bytes

Versions: 39

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

require "active_support/callbacks"

module ActionMailbox
  # = Action Mailbox \Callbacks
  #
  # Defines the callbacks related to processing.
  module Callbacks
    extend  ActiveSupport::Concern
    include ActiveSupport::Callbacks

    TERMINATOR = ->(mailbox, chain) do
      chain.call
      mailbox.finished_processing?
    end

    included do
      define_callbacks :process, terminator: TERMINATOR, skip_after_callbacks_if_terminated: true
    end

    class_methods do
      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

Version data entries

39 entries across 39 versions & 5 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/actionmailbox-7.1.3.4/lib/action_mailbox/callbacks.rb
actionmailbox-8.0.1 lib/action_mailbox/callbacks.rb
actionmailbox-8.0.0.1 lib/action_mailbox/callbacks.rb
actionmailbox-7.2.2.1 lib/action_mailbox/callbacks.rb
actionmailbox-7.1.5.1 lib/action_mailbox/callbacks.rb
actionmailbox-8.0.0 lib/action_mailbox/callbacks.rb
actionmailbox-7.2.2 lib/action_mailbox/callbacks.rb
actionmailbox-7.1.5 lib/action_mailbox/callbacks.rb
actionmailbox-8.0.0.rc2 lib/action_mailbox/callbacks.rb
actionmailbox-7.2.1.2 lib/action_mailbox/callbacks.rb
actionmailbox-7.1.4.2 lib/action_mailbox/callbacks.rb
actionmailbox-8.0.0.rc1 lib/action_mailbox/callbacks.rb
actionmailbox-7.2.1.1 lib/action_mailbox/callbacks.rb
actionmailbox-7.1.4.1 lib/action_mailbox/callbacks.rb
actionmailbox-8.0.0.beta1 lib/action_mailbox/callbacks.rb
omg-actionmailbox-8.0.0.alpha9 lib/action_mailbox/callbacks.rb
omg-actionmailbox-8.0.0.alpha8 lib/action_mailbox/callbacks.rb
omg-actionmailbox-8.0.0.alpha7 lib/action_mailbox/callbacks.rb
omg-actionmailbox-8.0.0.alpha4 lib/action_mailbox/callbacks.rb
omg-actionmailbox-8.0.0.alpha3 lib/action_mailbox/callbacks.rb