class AuthlogicOauth::Version

A class for describing the current version of a library. The version consists of three parts: the major number, the minor number, and the tiny (or patch) number.

Constants

CURRENT

The current version as a Version instance

MAJOR
MINOR
STRING

The current version as a String

TINY

Attributes

major[R]
minor[R]
tiny[R]

Public Class Methods

[](major, minor, tiny) click to toggle source

A convenience method for instantiating a new Version instance with the given major, minor, and tiny components.

# File lib/authlogic_oauth/version.rb, line 10
def self.[](major, minor, tiny)
  new(major, minor, tiny)
end
new(major, minor, tiny) click to toggle source

Create a new Version object with the given components.

# File lib/authlogic_oauth/version.rb, line 17
def initialize(major, minor, tiny)
  @major, @minor, @tiny = major, minor, tiny
end

Public Instance Methods

<=>(version) click to toggle source

Compare this version to the given version object.

# File lib/authlogic_oauth/version.rb, line 22
def <=>(version)
  to_i <=> version.to_i
end
to_a() click to toggle source
# File lib/authlogic_oauth/version.rb, line 38
def to_a
  [@major, @minor, @tiny]
end
to_i() click to toggle source

Converts this version to a canonical integer that may be compared against other version objects.

# File lib/authlogic_oauth/version.rb, line 34
def to_i
  @to_i ||= @major * 1_000_000 + @minor * 1_000 + @tiny
end
to_s() click to toggle source

Converts this version object to a string, where each of the three version components are joined by the ‘.’ character. E.g., 2.0.0.

# File lib/authlogic_oauth/version.rb, line 28
def to_s
  @to_s ||= [@major, @minor, @tiny].join(".")
end