class Gem::Specification

Gem::Specification is extended to support ‘current_specs` method.

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/finder/gem.rb, line 141
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