Sha256: 5dbe1080a3e2352db02197f156d9bf95dbd938eb7496965f79d387c039c77f8b

Contents?: true

Size: 1.18 KB

Versions: 82

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true
##
# 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 Gem::Resolver::ComposedSet < Gem::Resolver::Set
  attr_reader :sets # :nodoc:

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

  def initialize(*sets)
    super()

    @sets = sets
  end

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

  def prerelease=(allow_prerelease)
    super

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

  ##
  # Sets the remote network access for all composed sets.

  def remote=(remote)
    super

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

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

  ##
  # Finds all specs matching +req+ in all sets.

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

  ##
  # Prefetches +reqs+ in all sets.

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

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
rubygems-update-3.3.26 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.25 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.24 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.23 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.22 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.21 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.20 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.19 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.18 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.17 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.16 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.15 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.14 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.13 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.12 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.11 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.10 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.9 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.8 lib/rubygems/resolver/composed_set.rb
rubygems-update-3.3.7 lib/rubygems/resolver/composed_set.rb