33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb', line 33
def intersect(other)
raise ArgumentError, "packages must match" if package != other.package
if positive? && other.positive?
self.class.new(constraint.intersect(other.constraint), true)
elsif negative? && other.negative?
self.class.new(constraint.union(other.constraint), false)
else
positive = positive? ? self : other
negative = negative? ? self : other
self.class.new(positive.constraint.intersect(negative.constraint.invert), true)
end
end
|