lib/ruote/storage/base.rb in ruote-2.1.2 vs lib/ruote/storage/base.rb in ruote-2.1.3
- old
+ new
@@ -137,11 +137,11 @@
def put_schedule (flavour, owner_fei, s, msg)
at = if s.is_a?(Time) # at or every
at
- elsif Rufus::Scheduler.is_cron_string(s) # cron
+ elsif is_cron_string(s) # cron
Rufus::CronLine.new(s).next_time(Time.now + 1)
else # at or every
Ruote.s_to_at(s)
end
at = at.utc
@@ -202,9 +202,21 @@
def filter_schedules (scheds, now)
now = Ruote.time_to_utc_s(now)
scheds.select { |sched| sched['at'] <= now }
+ end
+
+ # Waiting for a better implementation of it in rufus-scheduler 2.0.4
+ #
+ def 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
end