Outdated::Version
Inherits Comparable < Struct < Value < Object
A Outdated::Version describes a version number with #major,
#minor, #micro, and #nano components. Components beyond the
#major number may be nil. Note that the largest value for any
component is 2^16 - 1 (65535).
Constructors
Create a new Outdated::Version struct. The major number must not
be nil, but the other components may be.
Class methods
Parse a string into a Outdated::Version structure. If the version
string is not a valid version string, then nil is returned.
version = Outdated::Version.parse?("1.2.3")
version.major # => 1
version.minor # => 2
version.micro # => 3
version.nano # => nil
Outdated::Version.parse?("1.2-beta") => nil
Instance methods
Compare two Outdated::Version values to each other. Conventional
version ordering is used.
v_1_2 = Outdated::Version.parse?("1.2")
v_1_2_0 = Outdated::Version.parse?("1.2.0")
v_1_2_1 = Outdated::Version.parse?("1.2.1")
v_1_10 = Outdated::Version.parse?("1.10")
v_1_2_1 < v_10 # => true
v_1_2_0 < v_1_2_1 # => true
v_1_2 < v_1_2_1 # => true
v_1_2 < v_1_2_0 # => true
Determine the distance to anotherOutdated::Version value. The
distance is defined as the the absolute difference between the
#to_u64 values of the versions.
Convert an Outdated::Version to a string. Normal version
dot-notation is used for the version number.
Outdated::Version.new(1, 2, 3).to_s # => "1.2.3"
Convert an Outdated::Version to a UInt64. This is done by
concatenating each component (#major, #minor, #micro, #nano)
into a UInt64. nil values are treated as zeros.