Sha256: 2b1d0b33458fa62a32c5270dc42009bc2780683de5b06539bab8d0f50cc6fcb8

Contents?: true

Size: 819 Bytes

Versions: 16

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

module GoodJob
  module ActiveJobExtensions
    module Labels
      extend ActiveSupport::Concern

      module Prepends
        def initialize(*arguments)
          super
          self.good_job_labels = Array(self.class.good_job_labels.dup)
        end

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

        def deserialize(job_data)
          super
          self.good_job_labels = job_data.delete("good_job_labels")&.dup || []
        end
      end

      included do
        prepend Prepends
        class_attribute :good_job_labels, instance_accessor: false, instance_predicate: false, default: []
        attr_accessor :good_job_labels
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
good_job-4.3.0 lib/good_job/active_job_extensions/labels.rb
good_job-4.2.1 lib/good_job/active_job_extensions/labels.rb
good_job-4.2.0 lib/good_job/active_job_extensions/labels.rb
good_job-4.1.1 lib/good_job/active_job_extensions/labels.rb
good_job-4.1.0 lib/good_job/active_job_extensions/labels.rb
good_job-3.99.1 lib/good_job/active_job_extensions/labels.rb
good_job-4.0.3 lib/good_job/active_job_extensions/labels.rb
good_job-4.0.2 lib/good_job/active_job_extensions/labels.rb
good_job-4.0.1 lib/good_job/active_job_extensions/labels.rb
good_job-4.0.0 lib/good_job/active_job_extensions/labels.rb
good_job-3.99.0 lib/good_job/active_job_extensions/labels.rb
good_job-3.30.1 lib/good_job/active_job_extensions/labels.rb
good_job-3.30.0 lib/good_job/active_job_extensions/labels.rb
good_job-3.29.5 lib/good_job/active_job_extensions/labels.rb
good_job-3.29.4 lib/good_job/active_job_extensions/labels.rb
good_job-3.29.3 lib/good_job/active_job_extensions/labels.rb