class RakeTasks::Gem::Version
Public Class Methods
new(string_version)
click to toggle source
# File lib/rake_tasks/gem.rb, line 40 def initialize(string_version) @marks = string_version.split('.') @marks = @marks.map do |mark| if mark.to_i.to_s == mark.to_s mark.to_i else mark end end @scrubbed = false end
Public Instance Methods
next_major_version!()
click to toggle source
# File lib/rake_tasks/gem.rb, line 77 def next_major_version! scrub! @marks.count.times do |n| if n == 0 @marks[n] += 1 else @marks[n] = 0 end end end
next_minor_version!()
click to toggle source
# File lib/rake_tasks/gem.rb, line 63 def next_minor_version! scrub! @marks.count.times do |n| case n when 0 @marks[n] = @marks[n] when 1 @marks[n] += 1 else @marks[n] = 0 end end end
next_revision!()
click to toggle source
# File lib/rake_tasks/gem.rb, line 58 def next_revision! scrub! @marks[-1] += 1 end
scrub!()
click to toggle source
# File lib/rake_tasks/gem.rb, line 52 def scrub! return if @scrubbed @marks = @marks.select { |m| m.is_a?(Integer) } @scrubbed = true end
to_s()
click to toggle source
# File lib/rake_tasks/gem.rb, line 88 def to_s @marks.join('.') end