Module: Gem

Defined in:
lib/loadable/core_ext/rubygems.rb

Defined Under Namespace

Classes: Specification

Class Method Summary collapse

Class Method Details

.search(match, options = {}) ⇒ Object

Search RubyGems for matching paths in current gem versions.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/loadable/core_ext/rubygems.rb', line 4

def self.search(match, options={})
  return unless defined?(::Gem)
  matches = []
  Gem::Specification.current_specs.each do |spec|
    glob = File.join(spec.lib_dirs_glob, match)
    list = Dir[glob] #.map{ |f| f.untaint }
    list = list.map{ |d| d.chomp('/') }
    matches.concat(list)
  end
  matches
end