Module: RiotNotifier
- Defined in:
- lib/riot_notifier/base.rb,
lib/riot_notifier/none.rb,
lib/riot_notifier/module.rb,
lib/riot_notifier/version.rb,
lib/riot_notifier/libnotify.rb,
lib/riot_notifier/redgreen_binary.rb
Overview
Notifies via $HOME/bin/notify_redgreen (with notify-send)
Defined Under Namespace
Classes: Base, Libnotify, None, RedgreenBinary
Constant Summary
collapse
- VERSION =
"0.5.0"
Class Method Summary
collapse
Class Method Details
.new(*args, &block) ⇒ Object
14
15
16
17
|
# File 'lib/riot_notifier/module.rb', line 14
def self.new(*args, &block)
notifier_class = notifier_classes.detect(&:usable?) || None
notifier_class.new(*args, &block)
end
|
.notifier_classes ⇒ Object
44
45
46
|
# File 'lib/riot_notifier/module.rb', line 44
def self.notifier_classes
order.map { |o| resolve_notifier_class(o) }.compact - [None]
end
|
.order ⇒ Object
31
32
33
|
# File 'lib/riot_notifier/module.rb', line 31
def self.order
@order ||= []
end
|
.register(notifier) ⇒ Object
19
20
21
|
# File 'lib/riot_notifier/module.rb', line 19
def self.register(notifier)
order.unshift notifier
end
|
.resolve_notifier_class(o) ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/riot_notifier/module.rb', line 48
def self.resolve_notifier_class(o)
case o
when Class; o
when Symbol, String; const_get(o)
else
nil
end
end
|
.try(*order) ⇒ Object
Also known as:
[]
35
36
37
38
|
# File 'lib/riot_notifier/module.rb', line 35
def self.try(*order)
@order = order
self
end
|
.unregister(notifier) ⇒ Object
23
24
25
|
# File 'lib/riot_notifier/module.rb', line 23
def self.unregister(notifier)
order.delete notifier
end
|
.unregister_all ⇒ Object
27
28
29
|
# File 'lib/riot_notifier/module.rb', line 27
def self.unregister_all
order.clear
end
|