Sha256: 9d2da785bba64becce0068d16293036abd711a7d3c101c343134625678490a55

Contents?: true

Size: 512 Bytes

Versions: 7

Compression:

Stored size: 512 Bytes

Contents

# Notifies via $HOME/bin/notify_redgreen (with notify-send)
module RiotNotifier

  class RedgreenBinary < Base
    attr_reader :path
    PATH = ENV['HOME'] + "/bin/notify_redgreen"

    def initialize(path = PATH)
      super()
      @path = path
    end

    def notify(color, msg)
      msg.gsub!(/</, '&lt;')
      msg.gsub!(/"/, "\\\"")
      exec "#{@path} #{color} \"#{msg}\""
    end

    def exec(*args)
      Kernel.system(*args)
    end

    def self.usable?
      File.exist?(PATH)
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
riot_notifier-0.5.0 lib/riot_notifier/redgreen_binary.rb
riot_notifier-0.4.0 lib/riot_notifier/redgreen_binary.rb
riot_notifier-0.3.0 lib/riot_notifier/redgreen_binary.rb
riot_notifier-0.2.0 lib/riot_notifier/redgreen_binary.rb
riot_notifier-0.1.1 lib/riot_notifier/redgreen_binary.rb
riot_notifier-0.0.8 lib/riot_notifier/redgreen_binary.rb
riot_notifier-0.0.7 lib/riot_notifier/redgreen_binary.rb