Module: Quartz::Scheduler::InstanceMethods
- Defined in:
- lib/quartz/scheduler.rb
Instance Method Summary collapse
- #defaults ⇒ Object
- #job_factory ⇒ Object
- #run ⇒ Object
- #schedule(name, options, block) ⇒ Object
- #scheduler ⇒ Object
- #scheduler_factory ⇒ Object
Instance Method Details
#defaults ⇒ Object
48 49 50 51 52 |
# File 'lib/quartz/scheduler.rb', line 48 def defaults { :at=>0 } end |
#job_factory ⇒ Object
59 60 61 |
# File 'lib/quartz/scheduler.rb', line 59 def job_factory JobFactory.instance end |
#run ⇒ Object
62 63 64 |
# File 'lib/quartz/scheduler.rb', line 62 def run scheduler.start end |
#schedule(name, options, block) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/quartz/scheduler.rb', line 38 def schedule(name, , block) = defaults.merge job_factory.jobs[name.to_s] = block job_detail = JobDetail.new(name.to_s, "cronjob", CronJob.new(name.to_s)) at = Time.parse([:at]) rescue nil || [:at] cron_expression = Cronify.cronify([:every], at) trigger = CronTrigger.new("#{name.to_s}_crontrig", "cront_trig_group", name.to_s, "cronjob", cron_expression) scheduler.set_job_factory(job_factory) scheduler.schedule_job(job_detail, trigger) end |
#scheduler ⇒ Object
56 57 58 |
# File 'lib/quartz/scheduler.rb', line 56 def scheduler scheduler_factory.get_scheduler end |
#scheduler_factory ⇒ Object
53 54 55 |
# File 'lib/quartz/scheduler.rb', line 53 def scheduler_factory @scheduler_factor ||= StdSchedulerFactory.new end |