README.rdoc in rufus-scheduler-2.0.17 vs README.rdoc in rufus-scheduler-2.0.18

- old
+ new

@@ -1,6 +1,5 @@ - = rufus-scheduler rufus-scheduler is a Ruby gem for scheduling pieces of code (jobs). It understands running a job AT a certain time, IN a certain time, EVERY x time or simply via a CRON statement. rufus-scheduler is no replacement for cron/at since it runs inside of Ruby. @@ -58,14 +57,14 @@ This PlainScheduler accepts a :thread_name option : scheduler = Rufus::Scheduler::PlainScheduler.start_new(:thread_name => 'my scheduler') -might be helpful when tracking threads. +which might be helpful when tracking threads. -Note that is there is EventMachine present and running, +Note that if there is an EventMachine present and running, scheduler = Rufus::Scheduler.start_new will return an instance of Rufus::Scheduler::EmScheduler (leveraging EventMachine). @@ -76,16 +75,20 @@ scheduler.cron '0 22 * * 1-5' do # every day of the week at 22:00 (10pm) end -Rufus-scheduler supports two variants to that notation : seconds and timezones. +Rufus-scheduler supports three variants to that notation : seconds, last day of month and timezones. scheduler.cron '13 0 22 * * 1-5' do # every day of the week at 22:00:13 end + scheduler.cron '0 22 L * *' do + # every month on the last day at 22:00 + end + scheduler.cron '0 22 * * 1-5 Europe/Paris' do # every day of the week when it's 22:00 in Paris end scheduler.cron '0 22 * * 1-5 Etc/GMT+2' do # every day of the week when it's 22:00 in GMT+2 @@ -118,11 +121,11 @@ If you place scheduler.join -at then end of it will make the current (main) thread join the scheduler and prevent the Ruby runtime from exiting. +at the end, it will make the current (main) thread join the scheduler and prevent the Ruby runtime from exiting. You shouldn't be exposed to this issue when using EventMachine, since while running EM, your runtime won't exit. === important note about #join @@ -198,11 +201,11 @@ end scheduler.in '21m' :mutex => 'that_mutex' do puts "order espresso" end -the "order espresso" will only get triggered once the ristretto has been consumed. Rufus-scheduler, will create a 'that_mutex' mutex and keep track of it. Don't go on passing too many different mutex names, rufus-scheduler will keep track of each of them (they won't get garbage collected). +the "order espresso" will only get triggered once the ristretto has been consumed. Rufus-scheduler will create a 'that_mutex' mutex and keep track of it. Don't go on passing too many different mutex names, rufus-scheduler will keep track of each of them (they won't get garbage collected). It's OK to use a mutex directly: m = Mutex.new # ... @@ -238,21 +241,21 @@ puts "hello #{i}" sleep 1 end end -You mind end up with something that looks like +You might end up with something that looks like hello 0 hello 1 hello 2 hello 3 hello 3 hello 4 ... -This every job, will have overlaps. To prevent that: +This every job will have overlaps. To prevent that: scheduler.every '3s', :allow_overlapping => false do # ... end @@ -444,11 +447,11 @@ This timeout feature relies on an 'in' job scheduled at the moment the main job gets triggered, hence the '40m' time string format. == exceptions in jobs -By default, when exception occur when a job performs, the error message will be output to the STDOUT. +By default, when exceptions occur when a job performs, the error messages will be output to the STDOUT. It's easy to customize that behaviour : scheduler = Rufus::Scheduler::PlainScheduler.start_new # or @@ -562,17 +565,16 @@ http://github.com/jmettraux/rufus-scheduler/blob/master/CREDITS.txt == authors -John Mettraux, jmettraux@gmail.com, http://jmettraux.wordpress.com +John Mettraux, jmettraux@gmail.com, http://jmettraux.github.com == the rest of Rufus http://rufus.rubyforge.org == license MIT -