class Sidekiq::Batch::Callback::Worker

Public Instance Methods

perform(clazz, event, opts, bid, parent_bid) click to toggle source
# File lib/sidekiq/batch/callback.rb, line 7
def perform(clazz, event, opts, bid, parent_bid)
  return unless %w(success complete).include?(event)
  clazz, method = clazz.split("#") if (clazz && clazz.class == String && clazz.include?("#"))
  method = "on_#{event}" if method.nil?
  status = Sidekiq::Batch::Status.new(bid)

  if clazz && object = Object.const_get(clazz)
    instance = object.new
    instance.send(method, status, opts) if instance.respond_to?(method)
  end
end