Class: Blertr::GrowlNotifier

Inherits:
Notifier show all
Defined in:
lib/blertr/growl_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

#initializeGrowlNotifier

Returns a new instance of GrowlNotifier.



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

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

Instance Method Details

#alert(message) ⇒ Object



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

def alert message
  system("growlnotify -n \"Terminal\" -m \"took #{message.time_string}\" \"#{message.command}\"")
end

#can_alert?Boolean

Returns:

  • (Boolean)


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

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