Class: SidekiqUniqueJobs::OnConflict::Strategy Abstract

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/sidekiq_unique_jobs/on_conflict/strategy.rb

Overview

This class is abstract.

Abstract conflict strategy class

Author:

Direct Known Subclasses

Log, NullStrategy, Raise, Reject, Replace, Reschedule

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger, #logging_context

Constructor Details

#initialize(item) ⇒ Strategy

Returns a new instance of Strategy.

Parameters:

  • item (Hash)

    the Sidekiq job hash



17
18
19
# File 'lib/sidekiq_unique_jobs/on_conflict/strategy.rb', line 17

def initialize(item)
  @item = item
end

Instance Attribute Details

#itemHash (readonly)

The sidekiq job hash

Returns:

  • (Hash)

    the Sidekiq job hash



14
15
16
# File 'lib/sidekiq_unique_jobs/on_conflict/strategy.rb', line 14

def item
  @item
end

Instance Method Details

#callObject

Use strategy on conflict

Raises:

  • (NotImplementedError)

    needs to be implemented in child class



23
24
25
# File 'lib/sidekiq_unique_jobs/on_conflict/strategy.rb', line 23

def call
  raise NotImplementedError, "needs to be implemented in child class"
end

#replace?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/sidekiq_unique_jobs/on_conflict/strategy.rb', line 27

def replace?
  is_a?(Replace)
end