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.
Files changed (3) hide show
  1. data/README +1 -1
  2. data/lib/ruby-which.rb +11 -2
  3. metadata +1 -1
data/README CHANGED
@@ -11,7 +11,7 @@ library path if the given library is found in the $LOAD_PATH.
11
11
 
12
12
  == Installation
13
13
 
14
- gem install ruby-which --source http://gems.github.com
14
+ gem install --source http://gems.github.com Pistos-ruby-which
15
15
 
16
16
  == Example usage:
17
17
 
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
- return nil if ! require( lib )
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Pistos-ruby-which
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pistos