Class: Notifiers::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/notifiers/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.command?(command) ⇒ Boolean
25
26
27
|
# File 'lib/notifiers/base.rb', line 25
def self.command?(command)
`which #{command}` and $?.to_i.zero?
end
|
.darwin? ⇒ Boolean
17
18
19
|
# File 'lib/notifiers/base.rb', line 17
def self.darwin?
platform?(/darwin/)
end
|
.inherited(subclass) ⇒ Object
3
4
5
6
7
|
# File 'lib/notifiers/base.rb', line 3
def self.inherited(subclass)
@subclasses ||= []
@subclasses.push(subclass)
@subclasses
end
|
.installed? ⇒ Boolean
13
14
15
|
# File 'lib/notifiers/base.rb', line 13
def self.installed?
false
end
|
21
22
23
|
# File 'lib/notifiers/base.rb', line 21
def self.platform?(name)
RbConfig::CONFIG['host_os'] =~ name or RUBY_PLATFORM =~ name
end
|
.subclasses ⇒ Object
9
10
11
|
# File 'lib/notifiers/base.rb', line 9
def self.subclasses
@subclasses
end
|
Instance Method Details
#image(icon) ⇒ Object
48
49
50
51
|
# File 'lib/notifiers/base.rb', line 48
def image(icon)
@icon = icon
self
end
|
#install_instructions ⇒ Object
53
54
55
|
# File 'lib/notifiers/base.rb', line 53
def install_instructions
''
end
|
#message(text) ⇒ Object
38
39
40
41
|
# File 'lib/notifiers/base.rb', line 38
def message(text)
@message = text
self
end
|
#notify ⇒ Object
Also known as:
notify!
29
30
31
32
33
34
35
|
# File 'lib/notifiers/base.rb', line 29
def notify
notification = system(to_s)
puts install_instructions unless notification or install_instructions.empty?
notification
end
|
#title(text) ⇒ Object
43
44
45
46
|
# File 'lib/notifiers/base.rb', line 43
def title(text)
@title = text
self
end
|