Created
April 27, 2010 15:09
-
-
Save defunkt/380846 to your computer and use it in GitHub Desktop.
How to hook into Resque's `enqueue` method from a plugin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # How to hook into Resque's `enqueue` method from a plugin. | |
| module EnqueuePlugin | |
| # Only enqueues subclasses of GitHub::Job | |
| def enqueue(klass, *args) | |
| looks_okay?(klass) ? super : false | |
| end | |
| def looks_okay?(klass) | |
| klass < GitHub::Job | |
| end | |
| end | |
| Resque.extend EnqueuePlugin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
before_enqueue hooks are in resque as of 1.19.0