Sha256: 71ac61699d86aed7a549276d2e3d6cd2eff2258e42cf33c5cc7495c3a318327d
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module TestNotifier module Notifier autoload :Growl, "test_notifier/notifier/growl" autoload :Snarl, "test_notifier/notifier/snarl" autoload :OsdCat, "test_notifier/notifier/osd_cat" autoload :Knotify, "test_notifier/notifier/knotify" autoload :Kdialog, "test_notifier/notifier/kdialog" autoload :NotifySend, "test_notifier/notifier/notify_send" autoload :Placebo, "test_notifier/notifier/placebo" extend self def notifiers constants.collect do |name| const_get(name) end end def supported_notifiers notifiers.select {|notifier| notifier.supported?} end def from_name(name) notifier = const_get(classify(name.to_s)) rescue Exception nil end def supported_notifier_from_name(name) notifier = from_name(name) notifier && notifier.supported? ? notifier : nil end private def classify(string) string.gsub(/_(.)/sm) { "#{$1.upcase}" }.gsub(/^(.)/) { "#{$1.upcase}" } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
test_notifier-0.3.5.rc.1 | lib/test_notifier/notifier.rb |