Class: Quebert::Serializer::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/quebert/serializer.rb

Overview

Does this mean you could queue a job that could queue a job? Whoa!

Class Method Summary collapse

Class Method Details

.deserialize(hash) ⇒ Object


17
18
19
20
21
22
23
24
25
# File 'lib/quebert/serializer.rb', line 17

def self.deserialize(hash)
  hash = Support.stringify_keys(hash)
  job = Support.constantize(hash['job']).new(*deserialize_args(hash['args']))
  job.priority = hash['priority']
  job.delay = hash['delay']
  job.ttr = hash['ttr']
  job.queue = hash['queue']
  job
end

.serialize(job) ⇒ Object


6
7
8
9
10
11
12
13
14
15
# File 'lib/quebert/serializer.rb', line 6

def self.serialize(job)
  {
    'job' => job.class.name,
    'args' => serialize_args(job.args),
    'priority' => job.priority,
    'delay' => job.delay,
    'ttr' => job.ttr,
    'queue' => job.queue
  }
end