Closed DanielHeath closed 8 months ago
Hello,
thanks for this report.
Fugit.parse
is not supposed to raise an ArgumentError
on invalid input, it simply returns nil
. Fugit.do_parse
will raise on invalid input.
The fugit nat "every" constructs produces Fugit::Cron
instances. For example "every 3 hours" is turned into "0 /3 ". It breaks quickly as you noticed, with "every 17 hours" turned into "0 /17 " which, in fact, corresponds to "every day at midnight and at 5 pm".
I am OK with returning nil
/ raising an ArgumentError
for "every 27 hours", but for "every 17 hours", I lean towards returning nil for Fugit.parse("every 17 hours", strict: true)
, as seen in https://github.com/floraison/fugit/commit/ec91e88ab4ca4496b208dc6d62cebbc9c2bacaa5
Would that suit you?
Kind regards.
strict: true
would do it, yeah.
You're welcome.
:tada: Thank you!
Issue description
Fugit.parse
will happily acceptevery 17 hours
as a time specification, but cannot represent that interval in a crontab.How to reproduce
The simplest piece of code that reproduces the issue, for example:
Expected behavior
ArgumentError would be an appropriate exception to raise if an argument can't be processed correctly
Context
Please replace the content of this section with the output of the following commands: