Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cron_timezone_validator.rb « validators « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c5f51d6506071650aaad06b18550a668e496191f (plain)
1
2
3
4
5
6
7
8
9
10
11
# frozen_string_literal: true

# CronTimezoneValidator
#
# Custom validator for CronTimezone.
class CronTimezoneValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    cron_parser = Gitlab::Ci::CronParser.new(record.cron, record.cron_timezone)
    record.errors.add(attribute, " is invalid syntax") unless cron_parser.cron_timezone_valid?
  end
end