Module: VersionGem::Epoch::OverloadApiForEpoch
- Defined in:
- lib/version_gem/epoch.rb
Overview
Tweak the basic API so it will support Epoch Semantic Versioning
Instance Method Summary collapse
-
#epoch ⇒ Integer
*** OVERLOAD METHODS FROM API ***.
-
#major ⇒ Integer
The major version.
-
#to_a ⇒ Array<[Integer, String, NilClass]>
NOTE: This is not the same as _to_a, which returns an array of strings.
-
#to_h ⇒ Hash
The version number as a hash.
Instance Method Details
#epoch ⇒ Integer
*** OVERLOAD METHODS FROM API ***
The epoch version
28 29 30 |
# File 'lib/version_gem/epoch.rb', line 28 def epoch @epoch ||= _major / EPOCH_SIZE end |
#major ⇒ Integer
The major version
35 36 37 |
# File 'lib/version_gem/epoch.rb', line 35 def major @major ||= _major % EPOCH_SIZE end |
#to_a ⇒ Array<[Integer, String, NilClass]>
NOTE: This is not the same as _to_a, which returns an array of strings
The version number as an array of cast values where epoch and major are derived from a single string:
EPOCH * 1000 + MAJOR
59 60 61 |
# File 'lib/version_gem/epoch.rb', line 59 def to_a @to_a ||= [epoch, major, minor, patch, pre] end |
#to_h ⇒ Hash
The version number as a hash
42 43 44 45 46 47 48 49 50 |
# File 'lib/version_gem/epoch.rb', line 42 def to_h @to_h ||= { epoch: epoch, major: major, minor: minor, patch: patch, pre: pre, } end |