Module: MiniScheduler::Schedule
- Defined in:
- lib/mini_scheduler/schedule.rb
Instance Method Summary collapse
- #daily(options = nil) ⇒ Object
- #every(duration = nil) ⇒ Object
- #is_per_host ⇒ Object
-
#per_host ⇒ Object
schedule job independently on each host (looking at hostname).
- #queue(value = nil) ⇒ Object
- #schedule_info ⇒ Object
- #scheduled? ⇒ Boolean
Instance Method Details
#daily(options = nil) ⇒ Object
9 10 11 12 |
# File 'lib/mini_scheduler/schedule.rb', line 9 def daily( = nil) @daily = if @daily end |
#every(duration = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/mini_scheduler/schedule.rb', line 14 def every(duration = nil) if duration @every = duration if manager = MiniScheduler::Manager.current[queue] manager.ensure_schedule!(self) end end @every end |
#is_per_host ⇒ Object
29 30 31 |
# File 'lib/mini_scheduler/schedule.rb', line 29 def is_per_host @per_host end |
#per_host ⇒ Object
schedule job independently on each host (looking at hostname)
25 26 27 |
# File 'lib/mini_scheduler/schedule.rb', line 25 def per_host @per_host = true end |
#queue(value = nil) ⇒ Object
4 5 6 7 |
# File 'lib/mini_scheduler/schedule.rb', line 4 def queue(value = nil) @queue = value.to_s if value @queue ||= "default" end |
#schedule_info ⇒ Object
33 34 35 36 |
# File 'lib/mini_scheduler/schedule.rb', line 33 def schedule_info manager = MiniScheduler::Manager.without_runner manager.schedule_info self end |
#scheduled? ⇒ Boolean
38 39 40 |
# File 'lib/mini_scheduler/schedule.rb', line 38 def scheduled? !!@every || !!@daily end |