Module: VersionGem::Epoch::OverloadApiForEpoch
- Defined in:
- lib/version_gem/epoch.rb,
sig/version_gem/epoch.rbs
Overview
Tweak the basic API so it will support Epoch Semantic Versioning
Instance Method Summary collapse
- #_major ⇒ Integer
-
#epoch ⇒ Integer
The epoch component (derived).
-
#major ⇒ Integer
Override of Api#major returning the derived major component.
-
#to_a ⇒ Array[Integer | String | nil]
Array of components [epoch, major, minor, patch, pre].
-
#to_h ⇒ Hash[Symbol, (Integer | String | nil)]
Hash representation including epoch.
Instance Method Details
#_major ⇒ Integer
65 66 67 |
# File 'lib/version_gem/epoch.rb', line 65 def _major @_major ||= _to_a[0].to_i end |
#epoch ⇒ Integer
The epoch component (derived)
28 29 30 |
# File 'lib/version_gem/epoch.rb', line 28 def epoch @epoch ||= _major / EPOCH_SIZE end |
#major ⇒ Integer
Override of Api#major returning the derived major component
35 36 37 |
# File 'lib/version_gem/epoch.rb', line 35 def major @major ||= _major % EPOCH_SIZE end |
#to_a ⇒ Array[Integer | String | nil]
Array of components [epoch, major, minor, patch, pre]
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[Symbol, (Integer | String | nil)]
Hash representation including epoch
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 |