Module: Resque::Mixin::Async::ClassMethods
- Defined in:
- lib/resque/mixin/async.rb
Instance Method Summary collapse
- #async(method, *args) ⇒ Object
- #async_in_queue(run_queue, method, *args) ⇒ Object
-
#perform(*args) ⇒ Object
Performs a class method if id is nil or an instance method if id has a value.
- #queue ⇒ Object
- #queue=(queue_name) ⇒ Object
Instance Method Details
#async(method, *args) ⇒ Object
51 52 53 |
# File 'lib/resque/mixin/async.rb', line 51 def async(method, *args) Resque.enqueue(self, nil, method, *args) end |
#async_in_queue(run_queue, method, *args) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/resque/mixin/async.rb', line 55 def async_in_queue(run_queue, method, *args) orig_queue = self.queue self.queue = run_queue Resque.enqueue(self, nil, method, *args) self.queue = orig_queue end |
#perform(*args) ⇒ Object
Performs a class method if id is nil or an instance method if id has a value.
64 65 66 67 68 69 70 |
# File 'lib/resque/mixin/async.rb', line 64 def perform(*args) id = args.shift method = args.shift obj = id ? find(id) : self obj.send(method, *args) end |
#queue ⇒ Object
43 44 45 |
# File 'lib/resque/mixin/async.rb', line 43 def queue @queue || 'default' end |
#queue=(queue_name) ⇒ Object
47 48 49 |
# File 'lib/resque/mixin/async.rb', line 47 def queue=(queue_name) @queue = queue_name end |