Sha256: 36279e26e7ea4fff7a882c99303ffce7e1905967f73e153fa6b8cc136cf7a2e2
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module GitBumper # This object represents a git tag. It expects the following format of tags: # PREFIX.MAJOR.MINOR.PATCH # It provides some methods to parse and increment version numbers. class Tag REGEX = /\A([a-z]+)([0-9]+)\.([0-9]+)\.([0-9]+)\z/i # Parses a string into a Tag object. # # @param str [String] # @return [Tag] or false if str has an invalid format def self.parse(str) matches = str.scan(REGEX).flatten return false if matches.empty? new(matches[0], matches[1].to_i, matches[2].to_i, matches[3].to_i) end attr_reader :prefix attr_accessor :major, :minor, :patch # @param prefix [String] # @param major [Fixnum] # @param minor [Fixnum] # @param patch [Fixnum] def initialize(prefix, major, minor, patch) @prefix = prefix @major = major @minor = minor @patch = patch end # @return [String] def to_s "#{prefix}#{major}.#{minor}.#{patch}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git_bumper-0.1.0 | lib/git_bumper/tag.rb |