Closed darwin67 closed 5 years ago
Hello,
you can easily achieve that with:
require 'fugit'
class Fugit::Cron
def self.validate(s)
!! parse(s)
end
end
def Fugit.validate_cron(s)
!! parse_cron(s)
end
p Fugit::Cron.validate('5 * * * * *') # => true
p Fugit::Cron.validate('nada') # => false
p Fugit.validate_cron('5 * * * * *') # => true
p Fugit.validate_cron('nada') # => false
If you have any question or suggestion, they're welcome.
Best regards.
Thanks!
Issue description
It would be great to have a method like
.validate
that can validate and check if the syntax of the cron string is correct.How to reproduce
N/A
Expected behaviour
N/A
Context
I want to store the cron string into the database and use it later for checking purposes. So it would be great if I can do some validation with the string before saving it.
Additional context
N/A