Module: Herald::Watcher::Notifier::Growl

Defined in:
lib/herald/notifiers/growl.rb

Constant Summary collapse

@@notification_type =
"Herald Notification"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



9
10
11
12
13
14
# File 'lib/herald/notifiers/growl.rb', line 9

def self.extended(base)
  Herald.lazy_load('ruby-growl')
  class << base
    attr_accessor :growl, :sticky
  end
end

Instance Method Details

#notify(item) ⇒ Object

send a Growl notification



28
29
30
31
32
33
34
35
# File 'lib/herald/notifiers/growl.rb', line 28

def notify(item)
  begin
    @growl.notify(@@notification_type, item.title, item.message, @priority, @sticky)
  rescue Errno::ECONNREFUSED => e
    # TODO throw custom exception
    raise "Growl settings not configured to allow remote application registration. See Growl website docs: http://growl.info/documentation/exploring-preferences.php"
  end
end

#parse_options(options) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/herald/notifiers/growl.rb', line 16

def parse_options(options)
  @sticky = options.delete(:sticky) || false
  @priority = options.delete(:priority) || 1
  host = options.delete(:host) || "localhost"
  pass = options.delete(:pass) || nil
  @growl = ::Growl.new(host, "Herald", [@@notification_type], [@@notification_type], pass)
end

#testObject

no tests for Growl



25
# File 'lib/herald/notifiers/growl.rb', line 25

def test; end