Class: Bump::VersionNumber
- Inherits:
-
Object
- Object
- Bump::VersionNumber
- Defined in:
- lib/bump/domain/version_number.rb
Overview
The version number model
Instance Method Summary collapse
-
#bump(level) ⇒ void
Bumps the version at the given level.
-
#initialize(major, minor, patch, preid = nil) ⇒ VersionNumber
constructor
A new instance of VersionNumber.
-
#setPreid(preid) ⇒ void
Sets the preid.
-
#to_s ⇒ String
Returns the string representation of the version.
Constructor Details
#initialize(major, minor, patch, preid = nil) ⇒ VersionNumber
Returns a new instance of VersionNumber.
12 13 14 15 16 17 |
# File 'lib/bump/domain/version_number.rb', line 12 def initialize major, minor, patch, preid = nil @major = major @minor = minor @patch = patch @preid = preid end |
Instance Method Details
#bump(level) ⇒ void
This method returns an undefined value.
Bumps the version at the given level
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bump/domain/version_number.rb', line 23 def bump level case level when :major @major += 1 @minor = 0 @patch = 0 when :minor @minor += 1 @patch = 0 when :patch @patch += 1 end @preid = nil end |
#setPreid(preid) ⇒ void
This method returns an undefined value.
Sets the preid
43 44 45 |
# File 'lib/bump/domain/version_number.rb', line 43 def setPreid preid @preid = preid end |
#to_s ⇒ String
Returns the string representation of the version
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/bump/domain/version_number.rb', line 50 def to_s label = @major.to_s + '.' + @minor.to_s + '.' + @patch.to_s if @preid label = label + '-' + @preid end label end |