struct SemanticVersion
- SemanticVersion
- Struct
- Value
- Object
Overview
Conforms to Semantic Versioning 2.0.0
See https://semver.org/ for more information.
Included Modules
- Comparable(ShortVersion)
- Comparable(SemanticVersion)
Defined in:
short_version/extensions/semantic_version.crConstructors
-
.parse(str : ShortVersion) : self
Parses a
SemanticVersion
from the givenShortVersion
Instance Method Summary
-
#<=>(other : ShortVersion) : Int32
The comparison operator with ShortVersion.
-
#to_shortver
Returns the
ShortVersion
representation of this semantic version
Constructor Detail
Parses a SemanticVersion
from the given ShortVersion
require "short_version/ext/semantic_version"
shortver = ShortVersion.parse("1.23")
semver = SemanticVersion.parse(shortver)
semver # => SemanticVersion(@major=1, @minor=23, @patch=0, ... )
Instance Method Detail
def <=>(other : ShortVersion) : Int32
#
The comparison operator with ShortVersion.
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 "short_version/ext/semantic_version"
SemanticVersion.parse("1.2.3") <=> ShortVersion.parse("1.3") # => -1
SemanticVersion.parse("1.2.3") <=> ShortVersion.parse("1.2") # => 0
SemanticVersion.parse("1.2.3") <=> ShortVersion.parse("1.1") # => 1
def to_shortver
#
Returns the ShortVersion
representation of this semantic version
require "short_version/ext/semantic_version"
semver = SemanticVersion.parse("0.39.3")
semver.to_shortver # => ShortVersion(@major=0, @minor=39)