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
10 11 12 13 14 15 |
# File 'lib/mini_scheduler/schedule.rb', line 10 def daily( = nil) if @daily = end @daily end |
#every(duration = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/mini_scheduler/schedule.rb', line 17 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
32 33 34 |
# File 'lib/mini_scheduler/schedule.rb', line 32 def is_per_host @per_host end |
#per_host ⇒ Object
schedule job independently on each host (looking at hostname)
28 29 30 |
# File 'lib/mini_scheduler/schedule.rb', line 28 def per_host @per_host = true end |
#queue(value = nil) ⇒ Object
5 6 7 8 |
# File 'lib/mini_scheduler/schedule.rb', line 5 def queue(value = nil) @queue = value.to_s if value @queue ||= "default" end |
#schedule_info ⇒ Object
36 37 38 39 |
# File 'lib/mini_scheduler/schedule.rb', line 36 def schedule_info manager = MiniScheduler::Manager.without_runner manager.schedule_info self end |
#scheduled? ⇒ Boolean
41 42 43 |
# File 'lib/mini_scheduler/schedule.rb', line 41 def scheduled? !!@every || !!@daily end |