Class: Rake::Funnel::Support::Which

Inherits:
Object
  • Object
show all
Defined in:
lib/rake/funnel/support/which.rb

Class Method Summary collapse

Class Method Details

.which(executable) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/rake/funnel/support/which.rb', line 6

def which(executable)
  return executable if File.file?(executable)

  ENV['PATH']
    .split(File::PATH_SEPARATOR)
    .map { |path| File.join(path, executable) }
    .select { |path| File.file?(path) }
    .first
end