Class: RiotNotifier::Libnotify
- Defined in:
- lib/riot_notifier/libnotify.rb
Constant Summary collapse
- ICON =
{ :green => "emblem-default.png", :red => "false-angry.png" }
- OPTIONS =
{ :green => { :icon_path => ICON[:green], :timeout => 2.5, :urgency => :normal, :summary => ":-)" }, :red => { :icon_path => ICON[:red], :timeout => 2.5, :urgency => :critical, :summary => ":-(" } }
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#error, #fail, inherited, #initialize, #results
Constructor Details
This class inherits a constructor from RiotNotifier::Base
Class Method Details
.usable? ⇒ Boolean
31 32 33 34 35 36 |
# File 'lib/riot_notifier/libnotify.rb', line 31 def self.usable? require 'libnotify' true rescue LoadError false end |
Instance Method Details
#notify(color, msg) ⇒ Object
25 26 27 28 29 |
# File 'lib/riot_notifier/libnotify.rb', line 25 def notify(color, msg) = OPTIONS[color] or raise "unknown color #{color}" ::Libnotify.show(.merge(:body => msg)) end |