class Omnibus::SemanticVersion
Attributes
prefix[R]
version[R]
Public Class Methods
new(version_string)
click to toggle source
# File lib/omnibus/semantic_version.rb, line 22 def initialize(version_string) @prefix = if version_string =~ /^v/ "v" else "" end @version = Mixlib::Versioning.parse(version_string.gsub(/^v/, "")) if @version.nil? raise InvalidVersion, "#{version_string} could not be parsed as a valid version" end end
Public Instance Methods
next_major()
click to toggle source
# File lib/omnibus/semantic_version.rb, line 48 def next_major s = [version.major + 1, 0, 0].join(".") self.class.new("#{prefix}#{s}") end
next_minor()
click to toggle source
# File lib/omnibus/semantic_version.rb, line 43 def next_minor s = [version.major, version.minor + 1, 0].join(".") self.class.new("#{prefix}#{s}") end
next_patch()
click to toggle source
# File lib/omnibus/semantic_version.rb, line 38 def next_patch s = [version.major, version.minor, version.patch + 1].join(".") self.class.new("#{prefix}#{s}") end
to_s()
click to toggle source
# File lib/omnibus/semantic_version.rb, line 34 def to_s "#{prefix}#{version}" end