class Aruba::Platforms::UnixWhich
Implement ‘which(command)` for UNIX/Linux
@private
Attributes
Public Class Methods
Source
# File lib/aruba/platforms/unix_which.rb, line 61 def initialize @whiches = [] @whiches << AbsoluteOrRelativePathWhich @whiches << ProgramWhich @whiches << DefaultWhich end
Public Instance Methods
Source
# File lib/aruba/platforms/unix_which.rb, line 75 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
Find fully quallified path for program
@param [String] program
Name of program
@param [String] path
ENV['PATH']