Module: VersionGem::Api
- Defined in:
- lib/version_gem/api.rb
Instance Method Summary collapse
-
#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.
Instance Method Details
#major ⇒ Integer
The major version
13 14 15 |
# File 'lib/version_gem/api.rb', line 13 def major @major ||= _to_a[0].to_i end |
#minor ⇒ Integer
The minor version
20 21 22 |
# File 'lib/version_gem/api.rb', line 20 def minor @minor ||= _to_a[1].to_i end |
#patch ⇒ Integer
The patch version
27 28 29 |
# File 'lib/version_gem/api.rb', line 27 def patch @patch ||= _to_a[2].to_i end |
#pre ⇒ String, NilClass
The pre-release version, if any
34 35 36 |
# File 'lib/version_gem/api.rb', line 34 def pre @pre ||= _to_a[3] end |
#to_a ⇒ Array<[Integer, String, NilClass]>
The version number as an array of cast values
53 54 55 |
# File 'lib/version_gem/api.rb', line 53 def to_a @to_a ||= [major, minor, patch, pre] end |
#to_h ⇒ Hash
The version number as a hash
41 42 43 44 45 46 47 48 |
# File 'lib/version_gem/api.rb', line 41 def to_h @to_h ||= { major: major, minor: minor, patch: patch, pre: pre } end |
#to_s ⇒ String
The version number as a string
6 7 8 |
# File 'lib/version_gem/api.rb', line 6 def to_s self::VERSION end |