Sha256: 2e385c47d5205977244416f4843387533adec48bf84d8b45cfdc9f06f02cdb26

Contents?: true

Size: 750 Bytes

Versions: 86

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

module GoodJob
  class Setting < BaseRecord
    CRON_KEYS_DISABLED = "cron_keys_disabled"

    self.table_name = 'good_job_settings'

    def self.cron_key_enabled?(key)
      cron_disabled = find_by(key: CRON_KEYS_DISABLED)&.value || []
      cron_disabled.exclude?(key.to_s)
    end

    def self.cron_key_enable(key)
      setting = GoodJob::Setting.find_by(key: CRON_KEYS_DISABLED)
      return unless setting&.value&.include?(key.to_s)

      setting.value.delete(key.to_s)
      setting.save!
    end

    def self.cron_key_disable(key)
      setting = find_or_initialize_by(key: CRON_KEYS_DISABLED) do |record|
        record.value = []
      end
      setting.value << key
      setting.save!
    end
  end
end

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
good_job-3.26.2 app/models/good_job/setting.rb
good_job-3.26.1 app/models/good_job/setting.rb
good_job-3.26.0 app/models/good_job/setting.rb
good_job-3.25.0 app/models/good_job/setting.rb
good_job-3.24.0 app/models/good_job/setting.rb
good_job-3.23.0 app/models/good_job/setting.rb
good_job-3.22.0 app/models/good_job/setting.rb
good_job-3.21.5 app/models/good_job/setting.rb
good_job-3.21.4 app/models/good_job/setting.rb
good_job-3.21.3 app/models/good_job/setting.rb
good_job-3.21.2 app/models/good_job/setting.rb
good_job-3.21.1 app/models/good_job/setting.rb
good_job-3.21.0 app/models/good_job/setting.rb
good_job-3.20.0 app/models/good_job/setting.rb
good_job-3.19.4 app/models/good_job/setting.rb
good_job-3.19.3 app/models/good_job/setting.rb
good_job-3.19.2 app/models/good_job/setting.rb
good_job-3.19.1 app/models/good_job/setting.rb
good_job-3.19.0 app/models/good_job/setting.rb
good_job-3.18.3 app/models/good_job/setting.rb