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: 542c7d006ad22d333b614d640b0c1ec76393ea18 (plain)
1
2
3
4
5
6
7
8
9
# 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