diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-11 21:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-11 21:10:13 +0300 |
commit | e58ce90f147742c314b9cc08c2d1c0b585e39cf9 (patch) | |
tree | 467a1716bb63f4061e57b824c0e07532ca2fba4c /lib/gitlab/ci/cron_parser.rb | |
parent | 62cd7010ef91dcaa5a5a36790985053db0b38671 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci/cron_parser.rb')
-rw-r--r-- | lib/gitlab/ci/cron_parser.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitlab/ci/cron_parser.rb b/lib/gitlab/ci/cron_parser.rb index efd48a9b29f..bc03658aab8 100644 --- a/lib/gitlab/ci/cron_parser.rb +++ b/lib/gitlab/ci/cron_parser.rb @@ -6,6 +6,10 @@ module Gitlab VALID_SYNTAX_SAMPLE_TIME_ZONE = 'UTC' VALID_SYNTAX_SAMPLE_CRON = '* * * * *' + def self.parse_natural(expression, cron_timezone = 'UTC') + new(Fugit::Nat.parse(expression)&.original, cron_timezone) + end + def initialize(cron, cron_timezone = 'UTC') @cron = cron @cron_timezone = timezone_name(cron_timezone) @@ -27,6 +31,10 @@ module Gitlab try_parse_cron(VALID_SYNTAX_SAMPLE_CRON, @cron_timezone).present? end + def match?(time) + cron_line.match?(time) + end + private def timezone_name(timezone) |