Class: BackgroundWorker::WorkerExecution
- Inherits:
-
Object
- Object
- BackgroundWorker::WorkerExecution
- Defined in:
- lib/background_worker/worker_execution.rb
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#worker ⇒ Object
readonly
Returns the value of attribute worker.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(worker, method_name, options) ⇒ WorkerExecution
constructor
A new instance of WorkerExecution.
Constructor Details
#initialize(worker, method_name, options) ⇒ WorkerExecution
Returns a new instance of WorkerExecution.
5 6 7 8 9 10 |
# File 'lib/background_worker/worker_execution.rb', line 5 def initialize(worker, method_name, ) fail ArgumentError, "'uid' is required to identify worker" unless [:uid].present? @worker = worker @method_name = method_name = end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
3 4 5 |
# File 'lib/background_worker/worker_execution.rb', line 3 def method_name @method_name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/background_worker/worker_execution.rb', line 3 def end |
#worker ⇒ Object (readonly)
Returns the value of attribute worker.
3 4 5 |
# File 'lib/background_worker/worker_execution.rb', line 3 def worker @worker end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/background_worker/worker_execution.rb', line 12 def call worker.send(method_name, ) report_implicitly_successful unless completed? rescue StandardError => e log_worker_error(e) BackgroundWorker.after_exception(e) ensure log_worker_finality end |