struct SemanticVersion::Prerelease
inherits Struct
¶
Contains the pre-release version related to this semantic version
Included modules
Comparable
Class methods¶
.new(identifiers : Array(String | Int32) = [] of String | Int32)
¶
(identifiers : Array(String | Int32) = [] of String | Int32)
Creates a new Prerelease
instance with supplied array of identifiers
.parse(str : String) : self
¶
(str : String) : self
Parses a Prerelease
from the given pre-release version string
require "semantic_version"
prerelease = SemanticVersion::Prerelease.parse("rc.1.3")
prerelease # => SemanticVersion::Prerelease(@identifiers=["rc", 1, 3])
Methods¶
#<=>(other : self) : Int32
¶
(other : self) : Int32
The comparison operator.
Returns -1
, 0
or 1
depending on whether self
's pre-release is lower than other's,
equal to other's pre-release or greater than other's pre-release.
require "semantic_version"
prerelease1 = SemanticVersion::Prerelease.new(["rc", 1])
prerelease2 = SemanticVersion::Prerelease.new(["rc", 1, 2])
prerelease1 <=> prerelease2 # => -1
prerelease1 <=> prerelease1 # => 0
prerelease2 <=> prerelease1 # => 1
#identifiers : Array(String | Int32)
¶
: Array(String | Int32)
Array of identifiers that make up the pre-release metadata
#to_s(io : IO) : Nil
¶
(io : IO) : Nil
Returns the string representation of this semantic version's pre-release metadata
require "semantic_version"
semver = SemanticVersion.parse("0.27.1-rc.1")
semver.prerelease.to_s # => "rc.1"