Sha256: cfe60bb0f3913cbb59387330e1a69bd79e9954d0d783ef9d4d63a5593581788f

Contents?: true

Size: 779 Bytes

Versions: 4

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 ==(other)
      return super && other.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

4 entries across 4 versions & 1 rubygems

Version Path
rworkflow-0.7.3 lib/rworkflow/sidekiq_state.rb
rworkflow-0.7.2 lib/rworkflow/sidekiq_state.rb
rworkflow-0.7.1 lib/rworkflow/sidekiq_state.rb
rworkflow-0.7.0 lib/rworkflow/sidekiq_state.rb