Method: Aruba::Platforms::UnixWhich#call

Defined in:
lib/aruba/platforms/unix_which.rb

#call(program, path = ) ⇒ Object

Find fully quallified path for program

Parameters:

  • program (String)

    Name of program

  • path (String) (defaults to: )

    ENV

Raises:

  • (ArgumentError)


73
74
75
76
77
78
79
# 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