From 4949e2b291bc59ee3855882a29df3bff9edfd4e5 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Tue, 4 Apr 2017 19:14:49 +0900 Subject: Separate cron_valid? and cron_time_zone_valid? --- lib/gitlab/ci/cron_parser.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/gitlab') diff --git a/lib/gitlab/ci/cron_parser.rb b/lib/gitlab/ci/cron_parser.rb index 2d9ea26faf0..521e556f769 100644 --- a/lib/gitlab/ci/cron_parser.rb +++ b/lib/gitlab/ci/cron_parser.rb @@ -14,10 +14,12 @@ module Gitlab cron_line.next_time(time).in_time_zone(Time.zone) if cron_line.present? end - def validation - is_valid_cron = try_parse_cron(@cron, VALID_SYNTAX_SAMPLE_TIME_ZONE).present? - is_valid_cron_time_zone = try_parse_cron(VALID_SYNTAX_SAMPLE_CRON, @cron_time_zone).present? - return is_valid_cron, is_valid_cron_time_zone + def cron_valid? + try_parse_cron(@cron, VALID_SYNTAX_SAMPLE_TIME_ZONE).present? + end + + def cron_time_zone_valid? + try_parse_cron(VALID_SYNTAX_SAMPLE_CRON, @cron_time_zone).present? end private -- cgit v1.2.3