Module: Whereis

Defined in:
lib/whereis.rb

Class Method Summary collapse

Class Method Details

.boolean(executable) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/whereis.rb', line 23

def self.boolean(executable)
  output = self.whereis(executable)
  if output.match(/\w:\\|\//)
    return true
  else
    return false
  end
end

.whereis(executable) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/whereis.rb', line 11

def self.whereis(executable)
  whereis = nil
  if Uname.sysname.match(/.*n[i|u]x/)
    whereis = 'whereis'
  else
    whereis = 'where'
  end
  output = IO.popen("#{whereis} #{executable}")
  output = output.readlines
  output = output[0].chomp
  return output
end