Class: SvnAuto::Version
- Inherits:
-
Object
- Object
- SvnAuto::Version
- Includes:
- Comparable
- Defined in:
- lib/svnauto/version.rb
Overview
Help deal with version numbers. Verson numbers are made up of three parts: the major, minor, and macro numbers. These numbers are separated by periods:
MAJOR.MINOR.MACRO as in 1.0.2
In SvnAuto, release branches are created for MAJOR.MINOR release numbers. Release tags are used for MAJOR.MINOR.MACRO. That means that version 1.1 is open for bug fixes and feature enhancements, but version 1.1.4 is locked and can’t be updated.
Instance Attribute Summary collapse
-
#encoded ⇒ Object
readonly
the encoded version number for sorting.
-
#macro ⇒ Object
readonly
macro release number.
-
#major ⇒ Object
readonly
major release number.
-
#minor ⇒ Object
readonly
minor release number.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
allow comparison.
-
#initialize(version_string) ⇒ Version
constructor
create a new version object with the given version.
-
#major_minor ⇒ Object
give back just major.minor.
-
#to_s ⇒ Object
convert back to a string.
Constructor Details
#initialize(version_string) ⇒ Version
create a new version object with the given version
60 61 62 |
# File 'lib/svnauto/version.rb', line 60 def initialize (version_string) parse_version(version_string) end |
Instance Attribute Details
#encoded ⇒ Object (readonly)
the encoded version number for sorting
56 57 58 |
# File 'lib/svnauto/version.rb', line 56 def encoded @encoded end |
#macro ⇒ Object (readonly)
macro release number
52 53 54 |
# File 'lib/svnauto/version.rb', line 52 def macro @macro end |
#major ⇒ Object (readonly)
major release number
44 45 46 |
# File 'lib/svnauto/version.rb', line 44 def major @major end |
#minor ⇒ Object (readonly)
minor release number
48 49 50 |
# File 'lib/svnauto/version.rb', line 48 def minor @minor end |
Instance Method Details
#<=>(other) ⇒ Object
allow comparison
89 90 91 |
# File 'lib/svnauto/version.rb', line 89 def <=> (other) @encoded <=> other.encoded end |
#major_minor ⇒ Object
give back just major.minor
74 75 76 |
# File 'lib/svnauto/version.rb', line 74 def major_minor "#{@major}.#{@minor}" end |
#to_s ⇒ Object
convert back to a string
66 67 68 69 70 |
# File 'lib/svnauto/version.rb', line 66 def to_s str = "#{@major}.#{@minor}" str << ".#{@macro}" unless @macro.nil? str end |