lib/pub_grub/rubygems.rb in pub_grub-0.4.1 vs lib/pub_grub/rubygems.rb in pub_grub-0.4.2
- old
+ new
@@ -1,24 +1,18 @@
-require 'rubygems/requirement'
-
module PubGrub
module RubyGems
extend self
def requirement_to_range(requirement)
ranges = requirement.requirements.map do |(op, ver)|
case op
when "~>"
- # TODO: not sure this is correct for prereleases
- VersionRange.new(min: ver, max: ver.bump, include_min: true)
+ bump = ver.class.new(ver.bump.to_s + ".A")
+ VersionRange.new(min: ver, max: bump, include_min: true)
when ">"
VersionRange.new(min: ver)
when ">="
- if ver == Gem::Version.new("0")
- VersionRange.any
- else
- VersionRange.new(min: ver, include_min: true)
- end
+ VersionRange.new(min: ver, include_min: true)
when "<"
VersionRange.new(max: ver)
when "<="
VersionRange.new(max: ver, include_max: true)
when "="