lib/fugit/parse.rb in fugit-1.7.2 vs lib/fugit/parse.rb in fugit-1.8.0

- old
+ new

@@ -31,9 +31,22 @@ parse(s, opts) || fail(ArgumentError.new("found no time information in #{s.inspect}")) end + def parse_cronish(s, opts={}) + + r = parse_cron(s) || parse_nat(s, opts) + + r.is_a?(::Fugit::Cron) ? r : nil + end + + def do_parse_cronish(s, opts={}) + + parse_cronish(s) || + fail(ArgumentError.new("not cron or 'natural' cron string: #{s.inspect}")) + end + def determine_type(s) case self.parse(s) when ::Fugit::Cron then 'cron' when ::Fugit::Duration then 'in'