Class: Notifiers::NotifySend
- Inherits:
-
Base
- Object
- Base
- Notifiers::NotifySend
show all
- Defined in:
- lib/notifiers/notify_send.rb
Constant Summary
collapse
- COMMAND =
'notify-send'
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
command?, #image, inherited, #message, #notify, platform?, process?, subclasses, success_process_status?, #title
Class Method Details
.installed? ⇒ Boolean
7
8
9
|
# File 'lib/notifiers/notify_send.rb', line 7
def self.installed?
platform?(/(freebsd|linux)/) and command?(COMMAND)
end
|
Instance Method Details
#category(name) ⇒ Object
26
27
28
29
|
# File 'lib/notifiers/notify_send.rb', line 26
def category(name)
@category = name
self
end
|
#expire_time(time) ⇒ Object
16
17
18
19
|
# File 'lib/notifiers/notify_send.rb', line 16
def expire_time(time)
@expire_time = time
self
end
|
#hint(values) ⇒ Object
21
22
23
24
|
# File 'lib/notifiers/notify_send.rb', line 21
def hint(values)
@hint = values.collect.each { |element| element.to_s }.join(':')
self
end
|
#install_instructions ⇒ Object
43
44
45
|
# File 'lib/notifiers/notify_send.rb', line 43
def install_instructions
'notify-send is not installed. Install libnotify for your distribution.'
end
|
#to_s ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/notifiers/notify_send.rb', line 31
def to_s
command = COMMAND.dup
command << " --urgency=#{@urgency}" if @urgency
command << " --expire-time=#{@expire_time}" if @expire_time
command << " --icon=#{@icon}" if @icon
command << " --category=#{@category}" if @category
command << " --hint=#{@hint}" if @hint
command << " '#{@title}'" if @title
command << " '#{@message}'" if @message
command
end
|
#urgency(level) ⇒ Object
11
12
13
14
|
# File 'lib/notifiers/notify_send.rb', line 11
def urgency(level)
@urgency = level.to_s
self
end
|