Class: Gem::Specification
- Inherits:
-
Object
- Object
- Gem::Specification
- Defined in:
- lib/finder/gem.rb
Overview
Gem::Specification is extended to support ‘current_specs` method.
Class Method Summary collapse
-
.current_specs ⇒ Object
Return a list of active specs or latest version of spec if not active.
Class Method Details
.current_specs ⇒ Object
Return a list of active specs or latest version of spec if not active.
141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# 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 |