[Rubygems-developers] Bug: Gem.latest_load_paths

Gavin Sinclair gsinclair at soyabean.com.au
Sun Sep 19 19:31:53 EDT 2004

Here is the relevant section of the code:

    # Return only the latest partial paths in the given +gemdir+.
    def latest_partials(gemdir)
      latest = {}
      all_partials(gemdir).each do |gp|
        base = File.basename(gp)
        name, version = base.split('-')         # XXX: This is incorrect!
        ver = Gem::Version.new(version)
        if latest[name].nil? || ver > latest[name][0]
          latest[name] = [ver, gp]
      latest.collect { |k,v| v[1] }

If base == 'sqlite-ruby-2.0.1', then

  name, version = base.split('-')

gives incorrect results.  Further, the line after that one will throw
an exception.


More information about the Rubygems-developers mailing list