Class: Laters::InstanceMethodJob
- Inherits:
-
Object
- Object
- Laters::InstanceMethodJob
- Defined in:
- lib/laters/instance_method_job.rb
Overview
Job class that executes deferred instance methods with callbacks
This job is responsible for executing a method on an ActiveRecord object in the background. It runs all registered callbacks around the method execution.
Instance Method Summary collapse
-
#perform(object, method_name, *args, **kwargs) ⇒ Object
Executes the specified method on the given object.
Instance Method Details
#perform(object, method_name, *args, **kwargs) ⇒ Object
Executes the specified method on the given object
24 25 26 27 28 29 30 31 32 |
# File 'lib/laters/instance_method_job.rb', line 24 def perform(object, method_name, *args, **kwargs) if object.respond_to? :id Rails.logger.info "Calling deferred #{method_name} on #{object.class} ##{object.id}" else Rails.logger.info "Calling deferred #{object.class}##{method_name}" end object.run_callbacks(:laters) { object.send(method_name, *args, **kwargs) } end |