Skip to content

Instantly share code, notes, and snippets.

@defunkt
Created April 27, 2010 15:09
Show Gist options
  • Select an option

  • Save defunkt/380846 to your computer and use it in GitHub Desktop.

Select an option

Save defunkt/380846 to your computer and use it in GitHub Desktop.
How to hook into Resque's `enqueue` method from a plugin.
# 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
@DougPuchalski
Copy link

before_enqueue hooks are in resque as of 1.19.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment