Class | Gem::Version |
In: |
lib/rubygems/version.rb
|
Parent: | Object |
The Version class processes string versions into comparable values. A version string should normally be a series of numbers separated by periods. Each part (digits separated by periods) is considered its own number, and these are used for sorting. So for instance, 3.10 sorts higher than 3.2 because ten is greater than two.
If any part contains letters (currently only a-z are supported) then that version is considered prerelease. Versions with a prerelease part in the Nth part sort less than versions with N-1 parts. Prerelease parts are sorted alphabetically using the normal Ruby string sorting rules.
Prereleases sort between real releases (newest to oldest):
VERSION_PATTERN | = | '[0-9]+(\.[0-9a-z]+)*' |
version | [R] |
Constructs a Version from the version string. A version string is a series of digits or ASCII letters separated by dots.
Compares this version with other returning -1, 0, or 1 if the other version is larger, the same, or smaller than this one.
The release for this version (e.g. 1.2.0.a -> 1.2.0) Non-prerelease versions return themselves