module Bundler::VersionRanges
def self.for(requirement)
def self.for(requirement) ranges = requirement.requirements.map do |op, v| case op when "=" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(v, true)) when "!=" then NEq.new(v) when ">=" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(ReqR::INFINITY, false)) when ">" then ReqR.new(ReqR::Endpoint.new(v, false), ReqR::Endpoint.new(ReqR::INFINITY, false)) when "<" then ReqR.new(ReqR::Endpoint.new(ReqR::ZERO, true), ReqR::Endpoint.new(v, false)) when "<=" then ReqR.new(ReqR::Endpoint.new(ReqR::ZERO, true), ReqR::Endpoint.new(v, true)) when "~>" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(v.bump, false)) else raise "unknown version op #{op} in requirement #{requirement}" end end.uniq ranges, neqs = ranges.partition {|r| !r.is_a?(NEq) } [ranges.sort, neqs.map(&:version)] end