Module: Notifier
- Extended by:
- Notifier
- Included in:
- Notifier
- Defined in:
- lib/notifier.rb,
lib/notifier/gntp.rb,
lib/notifier/growl.rb,
lib/notifier/snarl.rb,
lib/notifier/kdialog.rb,
lib/notifier/knotify.rb,
lib/notifier/osd_cat.rb,
lib/notifier/placebo.rb,
lib/notifier/version.rb,
lib/notifier/adapters.rb,
lib/notifier/notify_send.rb,
lib/notifier/adapters/gntp.rb
Defined Under Namespace
Modules: Adapters, GNTP, Growl, Kdialog, Knotify, NotifySend, OsdCat, Placebo, Snarl, Version
Class Attribute Summary collapse
Instance Method Summary
collapse
Class Attribute Details
.default_notifier ⇒ Object
Returns the value of attribute default_notifier.
22
23
24
|
# File 'lib/notifier.rb', line 22
def default_notifier
@default_notifier
end
|
Instance Method Details
#from_name(name) ⇒ Object
43
44
45
46
47
|
# File 'lib/notifier.rb', line 43
def from_name(name)
const_get(classify(name.to_s))
rescue Exception
nil
end
|
#notifier ⇒ Object
25
26
27
|
# File 'lib/notifier.rb', line 25
def notifier
supported_notifier_from_name(default_notifier) || supported_notifiers.first
end
|
#notifiers ⇒ Object
33
34
35
36
37
|
# File 'lib/notifier.rb', line 33
def notifiers
constants.collect do |name|
const_get(name) unless %w[Placebo Adapters Version].include?(name.to_s)
end.compact + [Placebo]
end
|
#notify(options) ⇒ Object
29
30
31
|
# File 'lib/notifier.rb', line 29
def notify(options)
notifier.notify(options)
end
|
#os?(regex) ⇒ Boolean
54
55
56
|
# File 'lib/notifier.rb', line 54
def os?(regex)
RUBY_PLATFORM =~ regex || RbConfig::CONFIG["host_os"] =~ regex
end
|
#supported_notifier_from_name(name) ⇒ Object
49
50
51
52
|
# File 'lib/notifier.rb', line 49
def supported_notifier_from_name(name)
notifier = from_name(name)
notifier && notifier.supported? ? notifier : nil
end
|
#supported_notifiers ⇒ Object
39
40
41
|
# File 'lib/notifier.rb', line 39
def supported_notifiers
notifiers.select {|notifier| notifier.supported?}
end
|