module VersionGem::Epoch::OverloadApiForEpoch
Tweak the basic API so it will support Epoch
Semantic Versioning
Public Instance Methods
epoch()
click to toggle source
*** OVERLOAD METHODS FROM API ***
The epoch version
@return [Integer]
# File lib/version_gem/epoch.rb 28 def epoch 29 @epoch ||= _major / EPOCH_SIZE 30 end
major()
click to toggle source
The major version
@return [Integer]
# File lib/version_gem/epoch.rb 35 def major 36 @major ||= _major % EPOCH_SIZE 37 end
to_a()
click to toggle source
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
@return [Array<[Integer, String, NilClass]>]
# File lib/version_gem/epoch.rb 59 def to_a 60 @to_a ||= [epoch, major, minor, patch, pre] 61 end
to_h()
click to toggle source
The version number as a hash
@return [Hash]
# File lib/version_gem/epoch.rb 42 def to_h 43 @to_h ||= { 44 epoch: epoch, 45 major: major, 46 minor: minor, 47 patch: patch, 48 pre: pre, 49 } 50 end
Private Instance Methods
_major()
click to toggle source
# File lib/version_gem/epoch.rb 65 def _major 66 @_major ||= _to_a[0].to_i 67 end