Method: Bundler::PubGrub::Term#relation

Defined in:
lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb

#relation(other) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb', line 51

def relation(other)
  if positive? && other.positive?
    constraint.relation(other.constraint)
  elsif negative? && other.positive?
    if constraint.allows_all?(other.constraint)
      :disjoint
    else
      :overlap
    end
  elsif positive? && other.negative?
    if !other.constraint.allows_any?(constraint)
      :subset
    elsif other.constraint.allows_all?(constraint)
      :disjoint
    else
      :overlap
    end
  elsif negative? && other.negative?
    if constraint.allows_all?(other.constraint)
      :subset
    else
      :overlap
    end
  else
    raise
  end
end