method

load_specs

Importance_0
Ruby latest stable (v2_5_5) - 0 notes - Class: Local
load_specs(type) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rubygems/source/local.rb, line 37
  def load_specs type # :nodoc:
    @load_specs_names[type] ||= begin
      names = []

      @specs = {}

      Dir["*.gem"].each do |file|
        begin
          pkg = Gem::Package.new(file)
        rescue SystemCallError, Gem::Package::FormatError
          # ignore
        else
          tup = pkg.spec.name_tuple
          @specs[tup] = [File.expand_path(file), pkg]

          case type
          when :released
            unless pkg.spec.version.prerelease?
              names << pkg.spec.name_tuple
            end
          when :prerelease
            if pkg.spec.version.prerelease?
              names << pkg.spec.name_tuple
            end
          when :latest
            tup = pkg.spec.name_tuple

            cur = names.find { |x| x.name == tup.name }
            if !cur
              names << tup
            elsif cur.version < tup.version
              names.delete cur
              names << tup
            end
          else
            names << pkg.spec.name_tuple
          end
        end
      end

      names
    end
  end
Register or log in to add new notes.