Sha256: 4fa3e870145816998ebef6cf06e0db61f95d9427f6363274e198e2f50d7d36f8

Contents?: true

Size: 1010 Bytes

Versions: 24

Compression:

Stored size: 1010 Bytes

Contents

require "active_support/concern"

module RocketJob
  module Batch
    module Callbacks
      extend ActiveSupport::Concern
      include ActiveSupport::Callbacks

      included do
        define_callbacks :slice

        def self.before_slice(*filters, &blk)
          set_callback(:slice, :before, *filters, &blk)
        end

        def self.after_slice(*filters, &blk)
          set_callback(:slice, :after, *filters, &blk)
        end

        def self.around_slice(*filters, &blk)
          set_callback(:slice, :around, *filters, &blk)
        end

        # before_batch and after_batch are called asynchronously.
        # around_batch is not supported.
        define_callbacks :before_batch
        define_callbacks :after_batch

        def self.before_batch(*filters, &blk)
          set_callback(:before_batch, :before, *filters, &blk)
        end

        def self.after_batch(*filters, &blk)
          set_callback(:after_batch, :after, *filters, &blk)
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rocketjob-5.2.0 lib/rocket_job/batch/callbacks.rb
rocketjob-5.2.0.beta3 lib/rocket_job/batch/callbacks.rb
rocketjob-5.2.0.beta2 lib/rocket_job/batch/callbacks.rb
rocketjob-5.2.0.beta1 lib/rocket_job/batch/callbacks.rb