Module: Kettle::Dev::Version
- Defined in:
- lib/kettle/dev/version.rb
Overview
Version namespace for kettle-dev.
Constant Summary collapse
- VERSION =
The gem version.
"1.1.32"
Class Method Summary collapse
-
.gem_version ⇒ Gem::Version
rubocop:disable ThreadSafety/ClassInstanceVariable.
-
.major ⇒ Integer
The major version.
-
.minor ⇒ Integer
The minor version.
-
.patch ⇒ Integer
The patch version.
-
.pre ⇒ String, NilClass
The pre-release version, if any.
-
.to_a ⇒ Array<[Integer, String, NilClass]>
The version number as an array of cast values.
-
.to_h ⇒ Hash
The version number as a hash.
-
.to_s ⇒ String
The version number as a string.
Class Method Details
.gem_version ⇒ Gem::Version
rubocop:disable ThreadSafety/ClassInstanceVariable
The logic below, through the end of the file, comes from version_gem.
Extracted because version_gem depends on this gem, and circular dependencies are bad.
A Gem::Version for this version string
Useful when you need to compare versions or pass a Gem::Version instance
to APIs that expect it. This is equivalent to Gem::Version.new(to_s)
.
24 25 26 |
# File 'lib/kettle/dev/version.rb', line 24 def gem_version @gem_version ||= ::Gem::Version.new(to_s) end |
.major ⇒ Integer
The major version
38 39 40 |
# File 'lib/kettle/dev/version.rb', line 38 def major @major ||= _to_a[0].to_i end |
.minor ⇒ Integer
The minor version
45 46 47 |
# File 'lib/kettle/dev/version.rb', line 45 def minor @minor ||= _to_a[1].to_i end |
.patch ⇒ Integer
The patch version
52 53 54 |
# File 'lib/kettle/dev/version.rb', line 52 def patch @patch ||= _to_a[2].to_i end |
.pre ⇒ String, NilClass
The pre-release version, if any
59 60 61 |
# File 'lib/kettle/dev/version.rb', line 59 def pre @pre ||= _to_a[3] end |
.to_a ⇒ Array<[Integer, String, NilClass]>
The version number as an array of cast values
78 79 80 |
# File 'lib/kettle/dev/version.rb', line 78 def to_a @to_a ||= [major, minor, patch, pre] end |
.to_h ⇒ Hash
The version number as a hash
66 67 68 69 70 71 72 73 |
# File 'lib/kettle/dev/version.rb', line 66 def to_h @to_h ||= { major: major, minor: minor, patch: patch, pre: pre, } end |
.to_s ⇒ String
The version number as a string
31 32 33 |
# File 'lib/kettle/dev/version.rb', line 31 def to_s self::VERSION end |