struct

Mrcv::Core::Version

Inherits Comparable < Struct < Value < Object

Represents an immutable semantic version adhering to SemVer 2.0.0.

Constants

SEMVER_PATTERN = /\A[vV]?(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?(?:\.(0|[1-9]\d*))?(?:-([0-9A-Za-z.-]+))?(?:\+([0-9A-Za-z.-]+))?\z/

SemVer 2.0.0 regex pattern supporting optional leading 'v'/'V' and 1-3 segment integers

Constructors

new(major : Int32, minor : Int32 = 0, patch : Int32 = 0, prerelease : String | Nil = nil, build : String | Nil = nil)
Source
parse(raw : String) : Version

Parses a version string or raises InvalidVersionError

Source

Class methods

parse?(raw : String) : Version | Nil

Parses a version string, returning nil on format failure

Source

Instance methods

<=>(other : Version) : Int32

Implements SemVer 2.0.0 precedence ordering

Source
==(other : Version) : Bool

Value equality (precedence equality + matching prerelease)

Source
build
Source
bump_major
Source
bump_minor
Source
bump_patch
Source
hash(hasher)

Hash code generation consistent with ==

Source
major
Source
minor
Source
patch
Source
prerelease
Source
prerelease?
Source
stable?
Source
to_s(io : IO) : Nil

Serializes to standard SemVer string format

Source