Tools

A library of utility services and concerns.

Module: SleepingKingStudios::Tools::Toolbox::SemanticVersion

Parent Namespace
SleepingKingStudios::Tools::Toolbox
Defined In
lib/sleeping_king_studios/tools/toolbox/semantic_version.rb

Table Of Contents

Overview

Helper for generating semantic version strings.

Examples

module Version
  extend SleepingKingStudios::Tools::SemanticVersion

  MAJOR = 3
  MINOR = 1
  PATCH = 4
  PRERELEASE = 'beta'
  BUILD = 1
end

VERSION = Version.to_version
#=> '3.1.4-beta+1'

VERSION = Version.to_gem_version
#=> '3.1.4.beta.1'

See Also

Back To Top

Defined Under Namespace

Classes
InvalidVersionError

Back To Top

Instance Methods

#to_gem_version => String

Generates a RubyGems-compatible version string.

Concatenates the MAJOR, MINOR, and PATCH constant values with PRERELEASE and BUILD (if available) to generate a modified semantic version string compatible with Rubygems. The major, minor, patch, prerelease, and build values (if available) are separated by dots (.).

Examples

module Version
  extend SleepingKingStudios::Tools::SemanticVersion

  MAJOR = 3
  MINOR = 1
  PATCH = 4
  PRERELEASE = 'beta'
  BUILD = 1
end

VERSION = Version.to_gem_version
#=> '3.1.4.beta.1'

Returns

Raises

#to_version => String

Generates a standard Semver version string.

Concatenates the MAJOR, MINOR, and PATCH constant values with PRERELEASE and BUILD (if available) to generate a semantic version string. The major, minor, and patch values are separated by dots (.), then the prerelease (if available) preceded by a hyphen (-), and the build (if available) preceded by a plus (+).

Examples

module Version
  extend SleepingKingStudios::Tools::SemanticVersion

  MAJOR = 3
  MINOR = 1
  PATCH = 4
  PRERELEASE = 'beta'
  BUILD = 1
end

VERSION = Version.to_version
#=> '3.1.4-beta+1'

Returns

Raises

Back To Top


Back to Documentation | Reference | SleepingKingStudios | SleepingKingStudios::Tools | SleepingKingStudios::Tools::Toolbox