class Gem::Specification

Public Class Methods

current_specs() click to toggle source

Return a list of active specs or latest version of spec if not active.

# File lib/standard/facets/gem/specification/current_specs.rb, line 5
def self.current_specs
  named = Hash.new{|h,k| h[k] = [] }
  each{ |spec| named[spec.name] << spec }
  list = []
  named.each do |name, vers|
    if spec = vers.find{ |s| s.activated? }
      list << spec
    else
      spec = vers.max{ |a,b| a.version <=> b.version }
      list << spec
    end
  end
  return list
end

Public Instance Methods

find_requireable_file(file) click to toggle source

Return full path of requireable file given relative path.

# File lib/standard/facets/gem/specification/find_requireable_file.rb, line 5
def find_requireable_file(file)
  root = full_gem_path

  require_paths.each do |lib|
    base = File.join(root, lib, file)
    Gem.suffixes.each do |suf|
      path = "#{base}#{suf}"
      return path if File.file? path
    end
  end

  return nil
end