Class: Resque::Job
- Inherits:
-
Object
- Object
- Resque::Job
- Defined in:
- lib/resque-hijacker.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.create(queue, klass, *args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/resque-hijacker.rb', line 7 def create(queue, klass, *args) Resque.validate(klass, queue) if Resque.inline? constantize(klass).perform(*decode(encode(args))) else Resque.push(queue, :class => klass.to_s, :args => args, :database => Hijacker.current_client) end end |
Instance Method Details
#database ⇒ Object
29 30 31 |
# File 'lib/resque-hijacker.rb', line 29 def database @payload['database'] end |
#perform ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/resque-hijacker.rb', line 21 def perform if database.present? Hijacker.connect_to_master database end perform_without_hijacking end |
#perform_without_hijacking ⇒ Object
20 |
# File 'lib/resque-hijacker.rb', line 20 alias_method :perform_without_hijacking, :perform |