Sha256: e0e1fd6222789a9f87fb3ba70be0902d74c4c8197a48f66a389e5e7d5c4d5423

Contents?: true

Size: 912 Bytes

Versions: 5

Compression:

Stored size: 912 Bytes

Contents

##
# The BestSet chooses the best available method to query a remote index.
#
# It combines IndexSet and APISet

class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet

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

  def initialize sources = Gem.sources
    super()

    @sources = sources
  end

  ##
  # Picks which sets to use for the configured sources.

  def pick_sets # :nodoc:
    @sources.each_source do |source|
      @sets << source.dependency_resolver_set
    end
  end

  def find_all req # :nodoc:
    pick_sets if @remote and @sets.empty?

    super
  end

  def prefetch reqs # :nodoc:
    pick_sets if @remote and @sets.empty?

    super
  end

  def pretty_print q # :nodoc:
    q.group 2, '[BestSet', ']' do
      q.breakable
      q.text 'sets:'

      q.breakable
      q.pp @sets
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubygems-update-2.2.5 lib/rubygems/resolver/best_set.rb
rubygems-update-2.2.4 lib/rubygems/resolver/best_set.rb
rubygems-update-2.2.3 lib/rubygems/resolver/best_set.rb
rubygems-update-2.3.0 lib/rubygems/resolver/best_set.rb
rubygems-update-2.2.2 lib/rubygems/resolver/best_set.rb