Class: Object

Inherits:
BasicObject
Defined in:
lib/sh_util.rb

Instance Method Summary collapse

Instance Method Details

#find_in_load_path(file) ⇒ Object



15
16
17
18
19
20
# File 'lib/sh_util.rb', line 15

def find_in_load_path(file)
  $:.reverse.each do |path|
    joined = File.join(path, file)
    return joined if File.exists?(joined)
  end
end

#try_require(lib) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/sh_util.rb', line 4

def try_require lib
  found = nil
  begin
    require lib
    found = true
  rescue LoadError
    found = false
  end
  return found
end