Conforms to Semantic Versioning 2.0.0
See https://semver.org/ for more information.
Creates a new SemanticVersion
instance with the given major, minor, and patch versions and optionally build and pre-release version
Parses a SemanticVersion
from the given semantic version string
The comparison operator.
The build metadata of this semantic version
The major version of this semantic version
The minor version of this semantic version
The patch version of this semantic version
The pre-release version of this semantic version
Returns the string representation of this semantic version
Comparable(SemanticVersion)
Struct
Value
Object
Object
Creates a new SemanticVersion
instance with the given major, minor, and patch versions and optionally build and pre-release version
Raises ArgumentError
if prerelease is invalid pre-release version
Parses a SemanticVersion
from the given semantic version string
require "semantic_version" semver = SemanticVersion.parse("2.61.4") semver # => #<SemanticVersion:0x55b3667c9e70 @major=2, @minor=61, @patch=4, ... >
Raises ArgumentError
if str is not a semantic version.
The comparison operator.
Returns -1
, 0
or 1
depending on whether self
's version is lower than other's, equal to other's version or greater than other's version.
require "semantic_version" semver1 = SemanticVersion.new(1, 0, 0) semver2 = SemanticVersion.new(2, 0, 0) semver1 <=> semver2 # => -1 semver2 <=> semver2 # => 0 semver2 <=> semver1 # => 1
The pre-release version of this semantic version
Returns the string representation of this semantic version
require "semantic_version" semver = SemanticVersion.parse("0.27.1") semver.to_s # => "0.27.1"
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/SemanticVersion.html