Class: RiotNotifier::RedgreenBinary
- Defined in:
- lib/riot_notifier/redgreen_binary.rb
Constant Summary collapse
- PATH =
ENV['HOME'] + "/bin/notify_redgreen"
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #exec(*args) ⇒ Object
-
#initialize(path = PATH) ⇒ RedgreenBinary
constructor
A new instance of RedgreenBinary.
- #notify(color, msg) ⇒ Object
Methods inherited from Base
#error, #fail, inherited, #results
Constructor Details
#initialize(path = PATH) ⇒ RedgreenBinary
Returns a new instance of RedgreenBinary.
8 9 10 11 |
# File 'lib/riot_notifier/redgreen_binary.rb', line 8 def initialize(path = PATH) super() @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/riot_notifier/redgreen_binary.rb', line 5 def path @path end |
Class Method Details
.usable? ⇒ Boolean
23 24 25 |
# File 'lib/riot_notifier/redgreen_binary.rb', line 23 def self.usable? File.exist?(PATH) end |
Instance Method Details
#exec(*args) ⇒ Object
19 20 21 |
# File 'lib/riot_notifier/redgreen_binary.rb', line 19 def exec(*args) Kernel.system(*args) end |
#notify(color, msg) ⇒ Object
13 14 15 16 17 |
# File 'lib/riot_notifier/redgreen_binary.rb', line 13 def notify(color, msg) msg.gsub!(/</, '<') msg.gsub!(/"/, "\\\"") exec "#{@path} #{color} \"#{msg}\"" end |