Module: Que::Scheduler::DbSupport
- Defined in:
- lib/que/scheduler/db_support.rb
Class Method Summary collapse
- .enqueue_a_job(clazz, job_options = {}, job_args = []) ⇒ Object
-
.execute(str, args = []) ⇒ Object
Between Que versions the result of Que execute changed keys from strings to symbols.
- .job_attributes(enqueued_job) ⇒ Object
- .que_version ⇒ Object
Class Method Details
.enqueue_a_job(clazz, job_options = {}, job_args = []) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/que/scheduler/db_support.rb', line 19 def enqueue_a_job(clazz, = {}, job_args = []) if job_args.is_a?(Hash) clazz.enqueue(job_args, job_options: ) else clazz.enqueue(*job_args, job_options: ) end end |
.execute(str, args = []) ⇒ Object
Between Que versions the result of Que execute changed keys from strings to symbols. Here we wrap the concept and make sure either way produces symbols
15 16 17 |
# File 'lib/que/scheduler/db_support.rb', line 15 def execute(str, args = []) normalise_array_of_hashes(Que.execute(str, args)) end |
.job_attributes(enqueued_job) ⇒ Object
7 8 9 10 11 |
# File 'lib/que/scheduler/db_support.rb', line 7 def job_attributes(enqueued_job) enqueued_job.que_attrs.to_h.transform_keys(&:to_sym).tap do |hash| hash[:job_id] = hash.delete(:id) end end |
.que_version ⇒ Object
27 28 29 |
# File 'lib/que/scheduler/db_support.rb', line 27 def que_version @que_version ||= que_version_object.to_s end |