class Aruba::Platforms::UnixWhich
@private
Implement ‘which(command)` for UNIX/Linux
def call(program, path = ENV["PATH"])
-
path
(String
) -- -
program
(String
) --
def call(program, path = ENV["PATH"]) raise ArgumentError, "ENV['PATH'] cannot be empty" if path.nil? || path.empty? program = program.to_s whiches.find { |w| w.match? program }.new.call(program, path) end
def initialize
def initialize @whiches = [] @whiches << AbsoluteOrRelativePathWhich @whiches << ProgramWhich @whiches << DefaultWhich end