class Aruba::Platforms::UnixWhich

Implement `which(command)` for UNIX/Linux

@private

Attributes

whiches[R]

Public Class Methods

new() click to toggle source
# File lib/aruba/platforms/unix_which.rb, line 59
def initialize
  @whiches = []
  @whiches << AbsoluteOrRelativePathWhich
  @whiches << ProgramWhich
  @whiches << DefaultWhich
end

Public Instance Methods

call(program, path = ENV['PATH']) click to toggle source

Find fully quallified path for program

@param [String] program

Name of program

@param [String] path

ENV['PATH']
# File lib/aruba/platforms/unix_which.rb, line 73
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