Module: ActiveAsync::Async
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_async/async.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- CLASS_IDENTIFIER =
"__class__".freeze
Class Method Summary collapse
-
.perform(class_name, id, method, *args) ⇒ Object
This will be called by a worker when a job needs to be processed.
Instance Method Summary collapse
-
#async(method, *args) ⇒ Object
We can pass any instance method that we want to run later.
Class Method Details
.perform(class_name, id, method, *args) ⇒ Object
This will be called by a worker when a job needs to be processed
14 15 16 |
# File 'lib/active_async/async.rb', line 14 def perform(class_name, id, method, *args) deserialize(class_name, id).send(method, *args) end |
Instance Method Details
#async(method, *args) ⇒ Object
We can pass any instance method that we want to run later. Arguments should be serializable for Resque.
Setting ActiveAsync.skip = true will bypass async altogether.
46 47 48 |
# File 'lib/active_async/async.rb', line 46 def async(method, *args) ActiveAsync.queue_adapter.enqueue(self.class.to_s, id, method, *args) end |