Module: RSpec::SleepingKingStudios::Version Private

Defined in:
lib/rspec/sleeping_king_studios/version.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

The current version of the gem.

See Also:

Constant Summary collapse

MAJOR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Major version.

2
MINOR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Minor version.

4
PATCH =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Patch version.

1
PRERELEASE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Prerelease version.

nil
BUILD =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Build metadata.

nil

Class Method Summary collapse

Class Method Details

.to_gem_versionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Generates the gem version string from the Version constants.

Inlined here because dependencies may not be loaded when processing a gemspec, which results in the user being unable to install the gem for the first time.

See Also:

  • SleepingKingStudios::Tools::SemanticVersion#to_gem_version

29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rspec/sleeping_king_studios/version.rb', line 29

def self.to_gem_version
  str = "#{MAJOR}.#{MINOR}.#{PATCH}"

  prerelease = self.const_defined?(:PRERELEASE) ? PRERELEASE : nil
  str << ".#{prerelease}" unless prerelease.nil? || (prerelease.respond_to?(:empty?) && prerelease.empty?)

  build = self.const_defined?(:BUILD) ? BUILD : nil
  str << ".#{build}" unless build.nil? || (build.respond_to?(:empty?) && build.empty?)

  str
end