Class: Sidekiq::CurrentAttributes::Save
- Inherits:
-
Object
- Object
- Sidekiq::CurrentAttributes::Save
- Defined in:
- lib/sidekiq/middleware/current_attributes.rb
Instance Method Summary collapse
- #call(_, job, _, _) ⇒ Object
-
#initialize(cattr) ⇒ Save
constructor
A new instance of Save.
Constructor Details
#initialize(cattr) ⇒ Save
Returns a new instance of Save.
18 19 20 |
# File 'lib/sidekiq/middleware/current_attributes.rb', line 18 def initialize(cattr) @klass = cattr end |
Instance Method Details
#call(_, job, _, _) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/sidekiq/middleware/current_attributes.rb', line 22 def call(_, job, _, _) attrs = @klass.attributes if job.has_key?("cattr") job["cattr"].merge!(attrs) else job["cattr"] = attrs end yield end |