Sha256: 8d24cd50f4aaab6206af5a6dbfdb5ac9bc4fbec1f12965dd0e9d82247c76665c
Contents?: true
Size: 442 Bytes
Versions: 8
Compression:
Stored size: 442 Bytes
Contents
class Which # http://stackoverflow.com/questions/2108727/ # which-in-ruby-checking-if-program-exists-in-path-from-ruby def which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each { |ext| exe = File.join(path, "#{cmd}#{ext}") return exe if File.executable?(exe) && !File.directory?(exe) } end return nil end end
Version data entries
8 entries across 8 versions & 1 rubygems