Module: Notify

Defined in:
lib/notify.rb,
lib/notify.rb,
lib/notify/kdialog.rb,
lib/notify/version.rb,
lib/notify/libnotify.rb,
lib/notify/ruby_gntp.rb,
lib/notify/ruby-growl.rb,
lib/notify/growlnotify.rb,
lib/notify/notify-send.rb,
lib/notify/terminal-notifier.rb

Constant Summary collapse

VERSION =
'0.5.2'

Class Method Summary collapse

Class Method Details

.html_escape(text) ⇒ Object


18
19
20
# File 'lib/notify.rb', line 18

def self.html_escape(text)
  ERB::Util.html_escape(text)
end

.notify(title, message, option = {}) ⇒ Object


40
41
42
# File 'lib/notify.rb', line 40

def self.notify(title, message, options = {})
  puts "#{title}: #{message}"
end

.which(prog, path = ENV['PATH']) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/notify.rb', line 6

def self.which(prog, path=ENV['PATH'])
  if RUBY_PLATFORM.downcase =~ /mswin(?!ce)|mingw|bccwin|cygwin/
    path.split(File::PATH_SEPARATOR).each {|dir|
      f = File.join(dir,prog+".exe")
      return f if File.executable?(File.join(f)) && !File.directory?(f)
    }
    nil
  else
    return system("which #{prog} > /dev/null 2>&1")
  end
end