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

cron_validator.rb « validators « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cc07011d56bea8e2086daa26f6395afba2385428 (plain)
1
2
3
4
5
6
7
8
9
# CronValidator
#
# Custom validator for Cron.
class CronValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    cron_parser = Gitlab::Ci::CronParser.new(record.cron, record.cron_time_zone)
    record.errors.add(attribute, " is invalid syntax") unless cron_parser.cron_valid?
  end
end