Class: Aruba::Platforms::WindowsWhich::AbsoluteOrRelativePathWhich

Inherits:
Object
  • Object
show all
Defined in:
lib/aruba/platforms/windows_which.rb

Overview

Find path for absolute or relative command

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(program) ⇒ Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/aruba/platforms/windows_which.rb', line 22

def self.match?(program)
  Aruba.platform.absolute_path?(program) || Aruba.platform.relative_command?(program)
end

Instance Method Details

#call(program, _path) ⇒ Object


26
27
28
29
30
31
32
# File 'lib/aruba/platforms/windows_which.rb', line 26

def call(program, _path)
  # Expand `#path_exts`
  found = Dir[program].first

  return File.expand_path(found) if found && Aruba.platform.executable?(found)
  nil
end