Class: Blertr::NotifySendNotifier

Inherits:
Notifier
  • Object
show all
Defined in:
lib/blertr/notify_send_notifier.rb

Instance Attribute Summary

Attributes inherited from Notifier

#error_messages, #names

Instance Method Summary collapse

Methods inherited from Notifier

#in_time_window?, #name, #options, #set_option, #set_time, #will_alert?

Constructor Details

#initializeNotifySendNotifier

Returns a new instance of NotifySendNotifier.



5
6
7
8
# File 'lib/blertr/notify_send_notifier.rb', line 5

def initialize
  super
  @names = ["notify_send"]
end

Instance Method Details

#alert(message) ⇒ Object



10
11
12
# File 'lib/blertr/notify_send_notifier.rb', line 10

def alert message
  system("notify-send \"#{message.command}\" \"took #{message.time_string}\" 2> /dev/null")
end

#can_alert?Boolean

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/blertr/notify_send_notifier.rb', line 14

def can_alert?
  rtn = system("which notify-send > /dev/null 2>&1")
  error_messages << "notify-send not availible from $PATH" unless rtn
  rtn
end