Module: GoodJob::ActiveJobExtensions::NotifyOptions::Prepends

Defined in:
lib/good_job/active_job_extensions/notify_options.rb

Instance Method Summary collapse

Instance Method Details

#deserialize(job_data) ⇒ Object



35
36
37
38
# File 'lib/good_job/active_job_extensions/notify_options.rb', line 35

def deserialize(job_data)
  super
  self.good_job_notify = job_data["good_job_notify"]
end

#enqueue(options = {}) ⇒ Object



23
24
25
26
# File 'lib/good_job/active_job_extensions/notify_options.rb', line 23

def enqueue(options = {})
  self.good_job_notify = options[:good_job_notify] if options.key?(:good_job_notify)
  super
end

#serializeObject



28
29
30
31
32
33
# File 'lib/good_job/active_job_extensions/notify_options.rb', line 28

def serialize
  super.tap do |job_data|
    # Only serialize the value if present to reduce the size of the serialized job
    job_data["good_job_notify"] = good_job_notify unless good_job_notify.nil?
  end
end