Sha256: def64f3b65e9f14b04625d67076dc701d19f19298ef98c2967158401c08bc902
Contents?: true
Size: 891 Bytes
Versions: 2
Compression:
Stored size: 891 Bytes
Contents
module Gem class Specification ## # Provides retrieving only the latest versions of all gems on # your system regardless of multiple versions of a gem installed. # def self.latest_versions specs = Gem::Specification.find_all.map.inject({}) do |result, spec| if result.has_key?(spec.name) && result[spec.name].version < spec.version result[spec.name] = spec elsif !result.has_key?(spec.name) result[spec.name] = spec end result end specs.values end end end module Toolbox ## # Extends the functionality of a Gem::Specification to be able to retrieve the latest version of gems # currently on your system. # # == Usage # # Gem::Specification.latest_versions.each do |spec| # puts "#{spec.name} (#{spec.version})" # end # module GemSpecification end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-development-toolbox-1.4.0 | lib/toolbox/gem_specification.rb |
ruby-development-toolbox-1.3.2 | lib/toolbox/gem_specification.rb |