Class: ServiceTemplate::Version
- Inherits:
-
Object
- Object
- ServiceTemplate::Version
- Defined in:
- lib/service_template/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 36 37 38 39 40 41 |
# File 'lib/service_template/version.rb', line 18 def next_level(level) fail 'Unidentified Level' unless [:major, :minor, :patch].include?(level) parts = ServiceTemplate::VERSION.split('.').map { |p| p.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/service_template/version.rb', line 6 def next_major next_level(:major) end |
.next_minor ⇒ Object
10 11 12 |
# File 'lib/service_template/version.rb', line 10 def next_minor next_level(:minor) end |
.next_patch ⇒ Object
14 15 16 |
# File 'lib/service_template/version.rb', line 14 def next_patch next_level(:patch) end |