Sha256: c9b5faa0eae5e5722232686105b1992d0ee21a71ffa35eabcea30b664a72434a

Contents?: true

Size: 1011 Bytes

Versions: 14

Compression:

Stored size: 1011 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

14 entries across 14 versions & 1 rubygems

Version Path
rocketjob-5.1.1 lib/rocket_job/batch/callbacks.rb
rocketjob-5.1.0 lib/rocket_job/batch/callbacks.rb
rocketjob-5.0.0 lib/rocket_job/batch/callbacks.rb
rocketjob-5.0.0.rc1 lib/rocket_job/batch/callbacks.rb
rocketjob-5.0.0.beta4 lib/rocket_job/batch/callbacks.rb
rocketjob-5.0.0.beta3 lib/rocket_job/batch/callbacks.rb
rocketjob-5.0.0.beta2 lib/rocket_job/batch/callbacks.rb
rocketjob-5.0.0.beta lib/rocket_job/batch/callbacks.rb
rocketjob-4.3.0.beta2 lib/rocket_job/batch/callbacks.rb
rocketjob-4.3.0.beta lib/rocket_job/batch/callbacks.rb
rocketjob-4.2.0 lib/rocket_job/batch/callbacks.rb
rocketjob-4.1.1 lib/rocket_job/batch/callbacks.rb
rocketjob-4.1.0 lib/rocket_job/batch/callbacks.rb
rocketjob-4.0.0 lib/rocket_job/batch/callbacks.rb