Class: Sidekiq::CurrentAttributes::Load
- Inherits:
-
Object
- Object
- Sidekiq::CurrentAttributes::Load
- Includes:
- ServerMiddleware
- Defined in:
- lib/sidekiq/middleware/current_attributes.rb
Instance Attribute Summary
Attributes included from ServerMiddleware
Instance Method Summary collapse
- #call(_, job, _, &block) ⇒ Object
-
#initialize(cattrs) ⇒ Load
constructor
A new instance of Load.
Methods included from ServerMiddleware
Constructor Details
#initialize(cattrs) ⇒ Load
Returns a new instance of Load.
61 62 63 |
# File 'lib/sidekiq/middleware/current_attributes.rb', line 61 def initialize(cattrs) @cattrs = cattrs end |
Instance Method Details
#call(_, job, _, &block) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/sidekiq/middleware/current_attributes.rb', line 65 def call(_, job, _, &block) klass_attrs = {} @cattrs.each do |(key, strklass)| next unless job.has_key?(key) klass_attrs[strklass.constantize] = job[key] end wrap(klass_attrs.to_a, &block) end |