class Bundler::PubGrub::VersionUnion

def to_s

def to_s
  output = []
  ranges = self.ranges.dup
  while !ranges.empty?
    ne = []
    range = ranges.shift
    while !ranges.empty? && ranges[0].min.to_s == range.max.to_s
      ne << range.max
      range = range.span(ranges.shift)
    end
    ne.map! {|x| "!= #{x}" }
    if ne.empty?
      output << range.to_s
    elsif range.any?
      output << ne.join(', ')
    else
      output << "#{range}, #{ne.join(', ')}"
    end
  end
  output.join(" OR ")
end