Class: Gris::Version
- Inherits:
-
Object
- Object
- Gris::Version
- Defined in:
- lib/gris/version.rb
Class Method Summary collapse
Class Method Details
.next_level(level) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gris/version.rb', line 18 def next_level(level) raise 'Unidentified Level' unless [:major, :minor, :patch].include?(level) parts = Gris::VERSION.split('.').map(&:to_i) if level == :major parts[0] += 1 significant_index = 1 end if level == :minor parts[1] += 1 significant_index = 2 end if level == :patch parts[2] += 1 significant_index = 3 end parts.map.with_index { |_p, i| parts[i] = 0 if i >= significant_index } parts.join('.') end |
.next_major ⇒ Object
6 7 8 |
# File 'lib/gris/version.rb', line 6 def next_major next_level(:major) end |
.next_minor ⇒ Object
10 11 12 |
# File 'lib/gris/version.rb', line 10 def next_minor next_level(:minor) end |
.next_patch ⇒ Object
14 15 16 |
# File 'lib/gris/version.rb', line 14 def next_patch next_level(:patch) end |