list (Gem::SpecFetcher)

    # File lib/rubygems/spec_fetcher.rb, line 168
      def list(all = false, prerelease = false)
        # TODO: make type the only argument
        type = if all
                 :all
               elsif prerelease
                 :prerelease
               else
                 :latest
               end

        list = {}

        file = { :latest => 'latest_specs',
          :prerelease => 'prerelease_specs',
          :all => 'specs' }[type]

        cache = { :latest => @latest_specs,
          :prerelease => @prerelease_specs,
          :all => @specs }[type]

        Gem.sources.each do |source_uri|
          source_uri = URI.parse source_uri

          unless cache.include? source_uri
            cache[source_uri] = load_specs source_uri, file
          end

          list[source_uri] = cache[source_uri]
        end

        if type == :all
          list.values.map do |gems|
            gems.reject! { |g| g[1].prerelease? }
          end
        end

        list
      end