Class: Matheus::AlertMe
Instance Method Summary collapse
-
#call(*args) ⇒ Object
Usage: $ alert-me “sleep 1 && echo ‘Done!’” Runs the command and plays a sound based on its success or failure after it finishes.
Methods inherited from Command
Methods included from StringFormat
Methods included from Result::Methods
Instance Method Details
#call(*args) ⇒ Object
Usage:
$ alert-me "sleep 1 && echo 'Done!'"
Runs the command and plays a sound based on its success or failure after it finishes.
10 11 12 13 14 15 16 17 18 |
# File 'lib/matheus/alert_me.rb', line 10 def call(*args) if system(args.join(" ").presence || "true") system("afplay /System/Library/Sounds/Glass.aiff & true") else system("afplay /System/Library/Sounds/Sosumi.aiff & false") end rescue => e Failure(e.) end |