Sha256: 78b2ecc2ccc6b1a8fc0515d988be82a93088cfd9f302a5ebf967cca5732f7b43

Contents?: true

Size: 779 Bytes

Versions: 5

Compression:

Stored size: 779 Bytes

Contents

module Rworkflow
  class SidekiqState < State
    attr_accessor :worker_class

    def initialize(worker: nil, **options)
      super(**options)
      @worker_class = worker
    end

    def merge!(state)
      super
      @worker_class = state.worker_class if state.respond_to?(:worker_class)
    end

    def clone
      cloned = super
      cloned.worker_class = @worker_class

      return cloned
    end

    def ==(state)
      return super && state.worker_class == @worker_class
    end

    def to_h
      h = super
      h[:worker_class] = @worker_class

      return h
    end

    class << self
      def unserialize(state_hash)
        state = super(state_hash)
        state.worker_class = state_hash[:worker_class]

        return state
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rworkflow-0.6.5 lib/rworkflow/sidekiq_state.rb
rworkflow-0.6.4 lib/rworkflow/sidekiq_state.rb
rworkflow-0.6.3 lib/rworkflow/sidekiq_state.rb
rworkflow-0.6.2 lib/rworkflow/sidekiq_state.rb
rworkflow-0.6.1 lib/rworkflow/sidekiq_state.rb