class GitSu::Version
Constants
- REGEX
Attributes
major[R]
minor[R]
patch[R]
Public Class Methods
current()
click to toggle source
# File lib/gitsu/version.rb, line 31 def self.current Version.parse(VERSION) end
new(major, minor, patch)
click to toggle source
# File lib/gitsu/version.rb, line 46 def initialize(major, minor, patch) @major, @minor, @patch = major, minor, patch end
parse(string)
click to toggle source
# File lib/gitsu/version.rb, line 25 def self.parse(string) raise ParseError, "Couldn't parse string '#{string}' as version" unless REGEX =~ string parts = REGEX.match(string)[1..3].map {|e| e.to_i } Version.new(*parts) end
prompt(input, output, prompt, default)
click to toggle source
# File lib/gitsu/version.rb, line 35 def self.prompt(input, output, prompt, default) output.print "#{prompt} [#{default}]: " value = input.gets.strip if value.empty? default else Version.parse value end end
Public Instance Methods
==(other)
click to toggle source
# File lib/gitsu/version.rb, line 58 def ==(other) eql? other end
eql?(other)
click to toggle source
# File lib/gitsu/version.rb, line 62 def eql?(other) major = other.major && minor == other.minor && patch == other.patch end
next_minor()
click to toggle source
# File lib/gitsu/version.rb, line 50 def next_minor Version.new(@major, @minor + 1, 0) end
next_patch()
click to toggle source
# File lib/gitsu/version.rb, line 54 def next_patch Version.new(@major, @minor, @patch + 1) end
to_s()
click to toggle source
# File lib/gitsu/version.rb, line 66 def to_s "#{major}.#{minor}.#{patch}" end