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
47 48 49 50 51 |
# File 'lib/quartz/scheduler.rb', line 47 def defaults { :at=>0 } end |
#job_factory ⇒ Object
58 59 60 |
# File 'lib/quartz/scheduler.rb', line 58 def job_factory JobFactory.instance end |
#run ⇒ Object
61 62 63 |
# File 'lib/quartz/scheduler.rb', line 61 def run scheduler.start end |
#schedule(name, options, block) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# 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)) 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
55 56 57 |
# File 'lib/quartz/scheduler.rb', line 55 def scheduler scheduler_factory.get_scheduler end |
#scheduler_factory ⇒ Object
52 53 54 |
# File 'lib/quartz/scheduler.rb', line 52 def scheduler_factory @scheduler_factor ||= StdSchedulerFactory.new end |