Module: Versionomy::Format::Semver::ExtraMethods
- Defined in:
- lib/versionomy/format_definitions/semver.rb
Overview
Extra methods added to version values that use the semver schema.
Instance Method Summary collapse
-
#compatible_with?(version_) ⇒ Boolean
Returns true if this version is compatible with the given version, according to the Semantic Versioning specification.
-
#prerelease? ⇒ Boolean
Returns true if the version is a prerelease version– that is, if the prerelease_suffix is nonempty.
-
#release ⇒ Object
Returns the release for this version.
Instance Method Details
#compatible_with?(version_) ⇒ Boolean
Returns true if this version is compatible with the given version, according to the Semantic Versioning specification. For example, 1.1.0 is compatible with 1.0.0 but not vice versa, 1.1.1 and 1.1.0 are compatible with each other, while 1.0.0 and 2.0.0 are mutually incompatible.
90 91 92 |
# File 'lib/versionomy/format_definitions/semver.rb', line 90 def compatible_with?(version_) self.major == version_.major ? self.minor >= version_.minor : false end |
#prerelease? ⇒ Boolean
Returns true if the version is a prerelease version– that is, if the prerelease_suffix is nonempty.
70 71 72 |
# File 'lib/versionomy/format_definitions/semver.rb', line 70 def prerelease? prerelease_suffix.length > 0 end |
#release ⇒ Object
Returns the release for this version. For example, converts “1.2.0a1” to “1.2.0”. Non-prerelease versions return themselves unchanged.
79 80 81 |
# File 'lib/versionomy/format_definitions/semver.rb', line 79 def release prerelease? ? self.change(:prerelease_suffix => '') : self end |