Skip to content

Commit

Permalink
README corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
plashchynski committed Mar 4, 2015
1 parent d5f6900 commit fc0b634
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Now you are ready to move forward to create a job and schedule it.

#### Create Job

Crono can use Active Job jobs in `app/jobs/`. The only requirements is that the `perform` method should take no arguments.
Crono can use Active Job jobs from `app/jobs/`. The only requirements is that the `perform` method should take no arguments.

Here's an example of a test job:
app/jobs/test_job.rb
Expand All @@ -46,30 +46,30 @@ app/jobs/test_job.rb
end
end

The Active Job jobs is convenient because you can use one class in both periodic and enqueued ways. But it doesn't necessarily. Any class can be used as Job if it has a method `perform` without arguments:
The ActiveJob jobs is convenient because you can use one job in both periodic and enqueued ways. But Active Job is not required. Any class can be used as a crono job if it implements a method `perform` without arguments:

class TestJob # this is not active job class
class TestJob # This is not an Active Job job, but pretty legal Crono job.
def perform
# put you scheduled code here
# Comments.deleted.clean_up...
end
end


#### Schedule Jobs
#### Job Schedule

The schedule described in the configuration file `config/cronotab.rb`, that we created using `crono:install` or manually. The semantic is pretty straightforward:
The schedule described in the configuration file `config/cronotab.rb`, that created using `crono:install` or manually. The semantic is pretty straightforward:

Crono.perform(TestJob).every 2.days, at: "15:30"

You can schedule one job a few times if you want the job to be performed a few times a day:
You can schedule one job a few times, if you want a job to be performed a few times a day:

Crono.perform(TestJob).every 1.days, at: "00:00"
Crono.perform(TestJob).every 1.days, at: "12:00"
Crono.perform(TestJob).every 1.day, at: "00:00"
Crono.perform(TestJob).every 1.day, at: "12:00"

The `at` can be a Hash:

Crono.perform(TestJob).every 1.days, at: {hour: 12, min: 15}
Crono.perform(TestJob).every 1.day, at: {hour: 12, min: 15}


#### Run daemon
Expand Down

0 comments on commit fc0b634

Please sign in to comment.