2014-01-30 00:21:38 -05:00
|
|
|
module Scheduler::Schedule
|
2014-03-14 13:02:21 -04:00
|
|
|
|
|
|
|
def daily(options=nil)
|
|
|
|
if options
|
|
|
|
@daily = options
|
|
|
|
end
|
|
|
|
@daily
|
|
|
|
end
|
|
|
|
|
2014-01-30 00:21:38 -05:00
|
|
|
def every(duration=nil)
|
2014-02-05 18:14:41 -05:00
|
|
|
if duration
|
|
|
|
@every = duration
|
|
|
|
if manager = Scheduler::Manager.current
|
|
|
|
manager.ensure_schedule!(self)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@every
|
|
|
|
end
|
|
|
|
|
|
|
|
def schedule_info
|
|
|
|
manager = Scheduler::Manager.without_runner
|
|
|
|
manager.schedule_info self
|
|
|
|
end
|
|
|
|
|
|
|
|
def scheduled?
|
2014-03-14 13:02:21 -04:00
|
|
|
!!@every || !!@daily
|
2014-01-30 00:21:38 -05:00
|
|
|
end
|
|
|
|
end
|