Sha256: 111c939ddf7dca50fe02aa0e5a038df3bf8f76a7291568289fbdc9b4f203751a
Contents?: true
Size: 474 Bytes
Versions: 21
Compression:
Stored size: 474 Bytes
Contents
# frozen_string_literal: true module TasksScheduler class CronSchedulingValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return if value_valid?(value) record.errors[attribute] << (options[:message] || I18n.translate(:cron_scheduling_validator_error_message)) end private def value_valid?(value) ::CronParser.new(value).next true rescue ArgumentError false end end end
Version data entries
21 entries across 21 versions & 1 rubygems