Class: Backup::Notifier::Command
- Defined in:
- lib/backup/notifier/command.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Arguments to pass to the command.
-
#command ⇒ Object
Command to execute.
Attributes inherited from Base
#max_retries, #message, #model, #on_failure, #on_success, #on_warning, #retry_waitsec
Instance Method Summary collapse
-
#initialize(model, &block) ⇒ Command
constructor
A new instance of Command.
Methods inherited from Base
Methods included from Config::Helpers
Methods included from Utilities::Helpers
Constructor Details
#initialize(model, &block) ⇒ Command
Returns a new instance of Command.
36 37 38 39 40 41 |
# File 'lib/backup/notifier/command.rb', line 36 def initialize(model, &block) super instance_eval(&block) if block_given? @args ||= ["%L %v"] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Backup::Config::Helpers
Instance Attribute Details
#args ⇒ Object
Arguments to pass to the command.
Must be an array of strings or callable objects.
Callables will be invoked with #call(model, status), and the return value used as the argument.
In strings you can use the following placeholders:
%l - Model label %t - Model trigger %d - Backup duration (HH:MM:SS) %s - Status (success/failure/warning) %v - Status verb (succeeded/failed/succeeded with warnings)
All placeholders can be used with uppercase letters to capitalize the value.
Defaults to [ā%L %vā]
34 35 36 |
# File 'lib/backup/notifier/command.rb', line 34 def args @args end |
#command ⇒ Object
Command to execute.
Make sure it is accessible from your $PATH, or provide the absolute path to the command.
12 13 14 |
# File 'lib/backup/notifier/command.rb', line 12 def command @command end |