Class: Notifiers::Growl

Inherits:
Base
  • Object
show all
Defined in:
lib/notifiers/growl.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

command?, darwin?, inherited, #message, #notify, platform?, subclasses, #title

Class Method Details

.installed?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/notifiers/growl.rb', line 3

def self.installed?
  darwin? and command?('growlnotify')
end

Instance Method Details

#auth(authentication) ⇒ Object



27
28
29
30
# File 'lib/notifiers/growl.rb', line 27

def auth(authentication)
  @auth = authentication
  self
end

#host(hostname) ⇒ Object



17
18
19
20
# File 'lib/notifiers/growl.rb', line 17

def host(hostname)
  @host = hostname
  self
end

#image(icon) ⇒ Object



7
8
9
10
# File 'lib/notifiers/growl.rb', line 7

def image(icon)
  @image = icon
  self
end

#install_instructionsObject



43
44
45
# File 'lib/notifiers/growl.rb', line 43

def install_instructions
  'The Growl is not installed. You can find more details here: http://growl.info/downloads'
end

#password(secret) ⇒ Object



22
23
24
25
# File 'lib/notifiers/growl.rb', line 22

def password(secret)
  @password = secret
  self
end

#priority(number) ⇒ Object



12
13
14
15
# File 'lib/notifiers/growl.rb', line 12

def priority(number)
  @priority = number
  self
end

#to_sObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/notifiers/growl.rb', line 32

def to_s
  command = 'growlnotify'
  command << " --title '#{@title}'" if @title
  command << " --message '#{@message}'"
  [:image, :priority, :host, :password, :auth].each do |option|
    variable = instance_variable_get("@#{option}")
    command << " --#{option} #{variable}" if variable
  end
  command
end