123456789_123456789_123456789_123456789_123456789_

Class: Gem::Resolver::ComposedSet

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

Overview

A ComposedSet allows multiple sets to be queried like a single set.

To create a composed set with any number of sets use:

Gem::Resolver.compose_sets set1, set2

This method will eliminate nesting of composed sets.

Class Method Summary

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.

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

.new(*sets) ⇒ ComposedSet

Creates a new ComposedSet containing #sets. Use Gem::Resolver.compose_sets instead.

[ GitHub ]

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

def initialize *sets
  super()

  @sets = sets
end

Instance Attribute Details

#prerelease=(allow_prerelease) (writeonly)

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

[ GitHub ]

  
# File 'lib/rubygems/resolver/composed_set.rb', line 29

def prerelease= allow_prerelease
  super

  sets.each do |set|
    set.prerelease = allow_prerelease
  end
end

#remote=(remote) (writeonly)

Sets the remote network access for all composed sets.

[ GitHub ]

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

def remote= remote
  super

  @sets.each { |set| set.remote = remote }
end

Instance Method Details

#errors

[ GitHub ]

  
# File 'lib/rubygems/resolver/composed_set.rb', line 46

def errors
  @errors + @sets.map { |set| set.errors }.flatten
end

#find_all(req)

Finds all specs matching req in all sets.

[ GitHub ]

  
# File 'lib/rubygems/resolver/composed_set.rb', line 53

def find_all req
  @sets.map do |s|
    s.find_all req
  end.flatten
end

#prefetch(reqs)

Prefetches reqs in all sets.

[ GitHub ]

  
# File 'lib/rubygems/resolver/composed_set.rb', line 62

def prefetch reqs
  @sets.each { |s| s.prefetch(reqs) }
end