Sha256: 4e8f885820a72166e36c078a84e1b973ac60991e93abaa45f132a31d975d24f8

Contents?: true

Size: 898 Bytes

Versions: 30

Compression:

Stored size: 898 Bytes

Contents

##
# The SourceSet chooses the best available method to query a remote index.
#
# Kind off like BestSet but filters the sources for gems

class Gem::Resolver::SourceSet < Gem::Resolver::Set

  ##
  # Creates a SourceSet for the given +sources+ or Gem::sources if none are
  # specified.  +sources+ must be a Gem::SourceList.

  def initialize
    super()

    @links = {}
    @sets  = {}
  end

  def find_all req # :nodoc:
    if set = get_set(req.dependency.name)
      set.find_all req
    else
      []
    end
  end

  # potentially no-op
  def prefetch reqs # :nodoc:
    reqs.each do |req|
      if set = get_set(req.dependency.name)
        set.prefetch reqs
      end
    end
  end

  def add_source_gem name, source
    @links[name] = source
  end

private

  def get_set(name)
    link = @links[name]
    @sets[link] ||= Gem::Source.new(link).dependency_resolver_set if link
  end

end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
rubygems-update-2.7.11 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.10 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.9 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.8 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.7 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.6 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.5 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.4 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.4.pre1 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.3 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.2 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.1 lib/rubygems/resolver/source_set.rb
rubygems-update-2.7.0 lib/rubygems/resolver/source_set.rb
rubygems-update-2.6.14 lib/rubygems/resolver/source_set.rb
rubygems-update-2.6.13 lib/rubygems/resolver/source_set.rb
rubygems-update-2.6.12 lib/rubygems/resolver/source_set.rb
rubygems-update-2.6.11 lib/rubygems/resolver/source_set.rb
rubygems-update-2.6.10 lib/rubygems/resolver/source_set.rb
rubygems-update-2.6.9 lib/rubygems/resolver/source_set.rb
ruby-compiler-0.1.1 vendor/ruby/lib/rubygems/resolver/source_set.rb