123456789_123456789_123456789_123456789_123456789_

Class: Gem::Resolver::SourceSet

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

Overview

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

Kind off like BestSet but filters the sources for gems

Class Method Summary

Set - Inherited

Instance Attribute Summary

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

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

.newSourceSet

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

[ GitHub ]

  
# File 'lib/rubygems/resolver/source_set.rb', line 12

def initialize
  super()

  @links = {}
  @sets  = {}
end

Instance Method Details

#add_source_gem(name, source)

[ GitHub ]

  
# File 'lib/rubygems/resolver/source_set.rb', line 36

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

#find_all(req)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rubygems/resolver/source_set.rb', line 19

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

#get_set(name) (private)

[ GitHub ]

  
# File 'lib/rubygems/resolver/source_set.rb', line 42

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

#prefetch(reqs)

This method is for internal use only.

potentially no-op

[ GitHub ]

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

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