Sha256: 5251d0f5e75f11ff6c6d675f621c010bb2a4cf1edd5c73d77cb0bbae23c0147a

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

# @api public
# @since 0.1.0
class Sidekiq::Portal::Config < Qonfig::DataSet
  # @return [String]
  #
  # @api private
  # @since 0.1.0
  DEFAULT_TIMEZONE = 'UTC'

  # @return [Hash]
  #
  # @api private
  # @since 0.1.0
  EMPTY_SCHEDULER_CONFIG = {}.freeze

  # @return [Integer]
  #
  # @api private
  # @since 0.1.0
  DEFAUL_RETRIES_COUNT = 0

  # @return [Array<Exception>]
  #
  # @api private
  # @since 0.1.0
  RETRY_ON_EXCEPTIONS = [StandardError].freeze

  # @since 0.1.0
  setting :default_timezone, DEFAULT_TIMEZONE
  # @since 0.1.0
  setting :retry_count, DEFAUL_RETRIES_COUNT
  # @since 0.1.0
  setting :retry_on, RETRY_ON_EXCEPTIONS
  # @since 0.1.0
  setting :scheduler_config, EMPTY_SCHEDULER_CONFIG

  # @since 0.1.0
  validate :default_timezone do |value|
    value.is_a?(String) && !ActiveSupport::TimeZone[value].nil?
  end

  # @since 0.1.0
  validate :retry_on do |value|
    value.is_a?(Array) && (value.all? do |exception_klass|
      exception_klass.is_a?(Class) && exception_klass <= ::Exception
    end)
  end

  # @since 0.1.0
  validate :retry_count, :integer, strict: true
  # @since 0.1.0
  validate :scheduler_config, :hash, strict: true
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq_portal-0.2.0 lib/portal/config.rb