123456789_123456789_123456789_123456789_123456789_

Class: Gem::Resolver::BestSet

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, ComposedSet, Set
Instance Chain:
self, ComposedSet, Set
Inherits: Gem::Resolver::ComposedSet
Defined in: lib/rubygems/resolver/best_set.rb

Overview

The BestSet chooses the best available method to query a remote index.

It combines IndexSet and APISet

Class Method Summary

ComposedSet - Inherited

.new

Creates a new ComposedSet containing sets.

Set - Inherited

Instance Attribute Summary

ComposedSet - Inherited

#prerelease=

When allow_prerelease is set to true prereleases gems are allowed to match dependencies.

#remote=

Sets the remote network access for all composed sets.

#sets

Set - Inherited

#errors

Errors encountered when resolving gems.

#prerelease

When true, allows matching of requests to prerelease gems.

#remote

Set to true to disable network access for this set.

#remote?

When true, this set is allowed to access the network when looking up specifications or dependencies.

Instance Method Summary

ComposedSet - Inherited

#errors,
#find_all

Finds all specs matching req in all sets.

#prefetch

Prefetches reqs in all sets.

Set - Inherited

#find_all

The find_all method must be implemented.

#prefetch

The #prefetch method may be overridden, but this is not necessary.

Constructor Details

.new(sources = Gem.sources) ⇒ BestSet

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

[ GitHub ]

  
# File 'lib/rubygems/resolver/best_set.rb', line 13

def initialize(sources = Gem.sources)
  super()

  @sources = sources
end

Instance Method Details

#find_all(req)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rubygems/resolver/best_set.rb', line 28

def find_all(req) # :nodoc:
  pick_sets if @remote && @sets.empty?

  super
end

#pick_sets

This method is for internal use only.

Picks which sets to use for the configured sources.

[ GitHub ]

  
# File 'lib/rubygems/resolver/best_set.rb', line 22

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

#prefetch(reqs)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rubygems/resolver/best_set.rb', line 34

def prefetch(reqs) # :nodoc:
  pick_sets if @remote && @sets.empty?

  super
end

#pretty_print(q)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rubygems/resolver/best_set.rb', line 40

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

    q.breakable
    q.pp @sets
  end
end