2013-11-21 18:27:30 -05:00
|
|
|
##
|
|
|
|
# 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.
|
|
|
|
|
2013-11-18 19:34:13 -05:00
|
|
|
class Gem::Resolver::ComposedSet < Gem::Resolver::Set
|
2013-11-10 12:51:40 -05:00
|
|
|
|
|
|
|
attr_reader :sets # :nodoc:
|
2013-07-09 19:21:36 -04:00
|
|
|
|
2013-11-21 18:27:30 -05:00
|
|
|
##
|
|
|
|
# Creates a new ComposedSet containing +sets+. Use
|
|
|
|
# Gem::Resolver::compose_sets instead.
|
|
|
|
|
2013-07-09 19:21:36 -04:00
|
|
|
def initialize *sets
|
|
|
|
@sets = sets
|
|
|
|
end
|
|
|
|
|
2013-11-21 18:27:30 -05:00
|
|
|
##
|
|
|
|
# Finds all specs matching +req+ in all sets.
|
|
|
|
|
2013-07-09 19:21:36 -04:00
|
|
|
def find_all req
|
|
|
|
res = []
|
|
|
|
@sets.each { |s| res += s.find_all(req) }
|
|
|
|
res
|
|
|
|
end
|
|
|
|
|
2013-11-21 18:27:30 -05:00
|
|
|
##
|
|
|
|
# Prefetches +reqs+ in all sets.
|
|
|
|
|
2013-07-09 19:21:36 -04:00
|
|
|
def prefetch reqs
|
|
|
|
@sets.each { |s| s.prefetch(reqs) }
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|