Method: SlidayBackup::Model#after
- Defined in:
- lib/sliday_backup/model.rb
#after(&block) ⇒ Object
Defines a block of code to run after the model’s procedures.
This code is ensured to run, even if the model failed, unless a before hook raised an exception and aborted the model.
The code block will be passed the model’s current exit_status:
0: Success, no warnings. 1: Success, but warnings were logged. 2: Failure, but additional models/triggers will still be processed. 3: Failure, no additional models/triggers will be processed.
The model’s exit_status may be elevated based on the after hook’s actions, but will never be decreased.
Warnings logged within the after hook may elevate the model’s exit_status to 1 and cause warning notifications to be sent.
Raising an exception may elevate the model’s exit_status and cause failure notifications to be sent. If the exception is a StandardError, the exit_status will be elevated to 2. If the exception is not a StandardError, the exit_status will be elevated to 3.
240 241 242 243 |
# File 'lib/sliday_backup/model.rb', line 240 def after(&block) @after = block if block @after end |