Module: Which

Defined in:
lib/utilities/which.rb

Overview

This module provides the equivalent of the unix which command. It is used by the ImageMagick module to check for the extistence of the ImageMagick command ‘identify’.

Class Method Summary collapse

Class Method Details

.which(command) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/utilities/which.rb', line 6

def self.which(command)
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
    command_path = File.join(path, command)
    return command_path if File.executable? command_path
  end

  nil
end