Sha256: 317483600d8c0eaf838c4944e5e1336d39f844e2ed53ed91bcbf47b606b26ba7
Contents?: true
Size: 570 Bytes
Versions: 2
Compression:
Stored size: 570 Bytes
Contents
module Acouchi class Which def self.which? command exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each { |ext| exe = "#{path}/#{command}#{ext}" return exe if File.executable? exe } end return nil end def self.find_executable *aliases if executable = aliases.find {|a| which? a} executable else raise %{Couldn't find any matches for the aliases "#{aliases.join(", ")}"} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acouchi-0.0.4 | lib/acouchi/which.rb |
acouchi-0.0.3 | lib/acouchi/which.rb |