lib/ruote/util/time.rb in ruote-2.1.7 vs lib/ruote/util/time.rb in ruote-2.1.8
- old
+ new
@@ -73,18 +73,28 @@
else
#
# duration
- duration = s.to_f rescue Rufus.parse_time_string(s)
-
- Time.now.utc.to_f + duration
+ Time.now.utc.to_f + Rufus.parse_time_string(s)
end
case at
when DateTime then at.to_time.utc
when Float then Time.at(at).utc
else at
end
+ end
+
+ # Waiting for a better implementation of it in rufus-scheduler 2.0.4
+ #
+ def self.is_cron_string (s)
+
+ ss = s.split(' ')
+
+ return false if ss.size < 5 || ss.size > 6
+ return false if s.match(/\d{4}/)
+
+ true
end
end