module VersionGem::Api

Public API of this library

Public Instance Methods

major() click to toggle source

The major version

@return [Integer]

   # File lib/version_gem/api.rb
16 def major
17   @major ||= _to_a[0].to_i
18 end
minor() click to toggle source

The minor version

@return [Integer]

   # File lib/version_gem/api.rb
23 def minor
24   @minor ||= _to_a[1].to_i
25 end
patch() click to toggle source

The patch version

@return [Integer]

   # File lib/version_gem/api.rb
30 def patch
31   @patch ||= _to_a[2].to_i
32 end
pre() click to toggle source

The pre-release version, if any

@return [String, NilClass]

   # File lib/version_gem/api.rb
37 def pre
38   @pre ||= _to_a[3]
39 end
to_a() click to toggle source

The version number as an array of cast values

@return [Array<[Integer, String, NilClass]>]

   # File lib/version_gem/api.rb
56 def to_a
57   @to_a ||= [major, minor, patch, pre]
58 end
to_h() click to toggle source

The version number as a hash

@return [Hash]

   # File lib/version_gem/api.rb
44 def to_h
45   @to_h ||= {
46     major: major,
47     minor: minor,
48     patch: patch,
49     pre: pre,
50   }
51 end
to_s() click to toggle source

The version number as a string

@return [String]

   # File lib/version_gem/api.rb
 9 def to_s
10   self::VERSION
11 end

Private Instance Methods

_to_a() click to toggle source

The version number as an array of strings

@return [Array<String>]

   # File lib/version_gem/api.rb
65 def _to_a
66   @_to_a = self::VERSION.split(".")
67 end