class Sidekiq::CurrentAttributes::Save

Public Class Methods

new(cattr) click to toggle source
# File lib/sidekiq/middleware/current_attributes.rb, line 20
def initialize(cattr)
  @strklass = cattr
end

Public Instance Methods

call(_, job, _, _) { || ... } click to toggle source
# File lib/sidekiq/middleware/current_attributes.rb, line 24
def call(_, job, _, _)
  attrs = @strklass.constantize.attributes
  if attrs.any?
    if job.has_key?("cattr")
      job["cattr"].merge!(attrs)
    else
      job["cattr"] = attrs
    end
  end
  yield
end