Created
September 15, 2012 11:00
-
-
Save diegok/3727350 to your computer and use it in GitHub Desktop.
Mojolicious plugin for resque
This file contains 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
package Mojolicious::Plugin::Resque; | |
use Mojo::Base 'Mojolicious::Plugin'; | |
use Resque; | |
use strict; | |
has config => sub {{}}; | |
has resque => sub { Resque->new(%{shift->config}) }; | |
sub register { | |
my ( $self, $cfg ) = @_; | |
$self->config($cfg) if $cfg && ref $cfg eq 'HASH'; | |
helper( resque => sub { $self->resque } ); | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment