Class: CanvasSync::JobUniqueness::Configuration

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Configurable
Defined in:
lib/canvas_sync/job_uniqueness/configuration.rb

Instance Method Summary collapse

Instance Method Details

#on_conflict=(action) ⇒ Object



13
14
15
16
17
# File 'lib/canvas_sync/job_uniqueness/configuration.rb', line 13

def on_conflict=(action)
  validate_on_conflict_action!(action)

  config.on_conflict = action
end

#validate_on_conflict_action!(action) ⇒ Object

Raises:

  • (ActiveJob::Uniqueness::InvalidOnConflictAction)


19
20
21
22
23
# File 'lib/canvas_sync/job_uniqueness/configuration.rb', line 19

def validate_on_conflict_action!(action)
  return if action.nil? || %i[log raise].include?(action) || action.respond_to?(:call)

  raise ActiveJob::Uniqueness::InvalidOnConflictAction, "Unexpected '#{action}' action on conflict"
end