1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Import RubyGems 1.0.0, r1575

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2007-12-20 08:39:12 +00:00
parent 40d8543fbd
commit 8289771e32
47 changed files with 1170 additions and 1010 deletions

View file

@ -75,7 +75,7 @@ class Gem::Version
# Strip ignored trailing zeros.
def normalize
@ints = @version.to_s.scan(/\d+/).map { |s| s.to_i }
@ints = build_array_from_version_string
return if @ints.length == 1
@ -127,19 +127,26 @@ class Gem::Version
@ints <=> other.ints
end
def hash
alias eql? == # :nodoc:
def hash # :nodoc:
to_ints.inject { |hash_code, n| hash_code + n }
end
# Return a new version object where the next to the last revision
# number is one greater. (e.g. 5.3.1 => 5.4)
def bump
ints = @ints.dup
ints = build_array_from_version_string
ints.pop if ints.size > 1
ints[-1] += 1
self.class.new(ints.join("."))
end
def build_array_from_version_string
@version.to_s.scan(/\d+/).map { |s| s.to_i }
end
private :build_array_from_version_string
#:stopdoc:
require 'rubygems/requirement'