Pistos-ruby-which 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -1
- data/lib/ruby-which.rb +11 -2
- metadata +1 -1
data/README
CHANGED
data/lib/ruby-which.rb
CHANGED
|
@@ -17,12 +17,16 @@ class Which
|
|
|
17
17
|
# Under rare circumstances, an Array may be returned in the case of multiple
|
|
18
18
|
# matches under one path.
|
|
19
19
|
def self.which( lib )
|
|
20
|
-
|
|
20
|
+
begin
|
|
21
|
+
Kernel#require( lib )
|
|
22
|
+
rescue LoadError
|
|
23
|
+
return nil
|
|
24
|
+
end
|
|
21
25
|
|
|
22
26
|
$LOAD_PATH.each do |path|
|
|
23
27
|
extension = nil
|
|
24
28
|
if File.extname( lib ).empty?
|
|
25
|
-
extension = '.{rb,so,class}'
|
|
29
|
+
extension = '.{rb,so,o,dll,class}'
|
|
26
30
|
end
|
|
27
31
|
found = Dir[ "#{path}/#{lib}#{extension}" ]
|
|
28
32
|
if found.size == 1
|
|
@@ -31,6 +35,11 @@ class Which
|
|
|
31
35
|
return found
|
|
32
36
|
end
|
|
33
37
|
end
|
|
38
|
+
|
|
34
39
|
nil
|
|
35
40
|
end
|
|
41
|
+
|
|
42
|
+
class << self
|
|
43
|
+
alias_method :require, :which
|
|
44
|
+
end
|
|
36
45
|
end
|