Class Gem::Version
In: lib/rubygems/version.rb
Parent: Object

The Version class processes string versions into comparable values

Methods

<=>   bump   correct?   create   hash   new   to_ints   to_s  

Included Modules

Comparable

Classes and Modules

Class Gem::Version::Requirement

Constants

NUM_RE = /\s*(\d+(\.\d+)*)*\s*/

Attributes

version  [RW] 

Public Class methods

Checks if version string is valid format

str:[String] the version string
return:[Boolean] true if the string format is correct, otherwise false

Factory method to create a Version object. Input may be a Version or a String. Intended to simplify client code.

  ver1 = Version.create('1.3.17')   # -> (Version object)
  ver2 = Version.create(ver1)       # -> (ver1)
  ver3 = Version.create(nil)        # -> nil

Constructs a version from the supplied string

version:[String] The version string. Format is digit.digit…

Public Instance methods

Compares two versions

other:[Version or .to_ints] other version to compare to
return:[Fixnum] -1, 0, 1

Return a new version object where the next to the last revision number is one greater. (e.g. 5.3.1 => 5.4)

Convert version to integer array

return:[Array] list of integers

Returns the text representation of the version

return:[String] version as string

[Validate]