Class: Sidekiq::CurrentAttributes::Save
- Inherits:
-
Object
- Object
- Sidekiq::CurrentAttributes::Save
show all
- Includes:
- ServerMiddleware
- Defined in:
- lib/sidekiq/middleware/current_attributes.rb
Instance Attribute Summary
#config
Instance Method Summary
collapse
#logger, #redis, #redis_pool
Constructor Details
#initialize(cattrs) ⇒ Save
29
30
31
|
# File 'lib/sidekiq/middleware/current_attributes.rb', line 29
def initialize(cattrs)
@cattrs = cattrs
end
|
Instance Method Details
#call(_, job, _, _) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/sidekiq/middleware/current_attributes.rb', line 33
def call(_, job, _, _)
@cattrs.each do |(key, strklass)|
if !job.has_key?(key)
attrs = strklass.constantize.attributes
job[key] = Serializer.serialize(attrs) if attrs.any?
end
end
yield
end
|