Module: Sidekiq::Queues
- Defined in:
- lib/sidekiq/testing.rb
Class Method Summary collapse
- .[](queue) ⇒ Object
- .clear_all ⇒ Object
- .clear_for(queue, klass) ⇒ Object
- .delete_for(jid, queue, klass) ⇒ Object
- .jobs_by_class ⇒ Object (also: jobs_by_worker)
- .jobs_by_queue ⇒ Object
- .push(queue, klass, job) ⇒ Object
Class Method Details
.[](queue) ⇒ Object
177 178 179 |
# File 'lib/sidekiq/testing.rb', line 177 def [](queue) jobs_by_queue[queue] end |
.clear_all ⇒ Object
205 206 207 208 |
# File 'lib/sidekiq/testing.rb', line 205 def clear_all jobs_by_queue.clear jobs_by_class.clear end |
.clear_for(queue, klass) ⇒ Object
200 201 202 203 |
# File 'lib/sidekiq/testing.rb', line 200 def clear_for(queue, klass) jobs_by_queue[queue.to_s].clear jobs_by_class[klass].clear end |
.delete_for(jid, queue, klass) ⇒ Object
195 196 197 198 |
# File 'lib/sidekiq/testing.rb', line 195 def delete_for(jid, queue, klass) jobs_by_queue[queue.to_s].delete_if { |job| job["jid"] == jid } jobs_by_class[klass].delete_if { |job| job["jid"] == jid } end |
.jobs_by_class ⇒ Object Also known as: jobs_by_worker
190 191 192 |
# File 'lib/sidekiq/testing.rb', line 190 def jobs_by_class @jobs_by_class ||= Hash.new { |hash, key| hash[key] = [] } end |
.jobs_by_queue ⇒ Object
186 187 188 |
# File 'lib/sidekiq/testing.rb', line 186 def jobs_by_queue @jobs_by_queue ||= Hash.new { |hash, key| hash[key] = [] } end |
.push(queue, klass, job) ⇒ Object
181 182 183 184 |
# File 'lib/sidekiq/testing.rb', line 181 def push(queue, klass, job) jobs_by_queue[queue] << job jobs_by_class[klass] << job end |