Class: ReleaseTagger::Version
- Inherits:
-
Struct
- Object
- Struct
- ReleaseTagger::Version
- Defined in:
- lib/release_tagger.rb
Instance Attribute Summary collapse
-
#major ⇒ Object
Returns the value of attribute major.
-
#minor ⇒ Object
Returns the value of attribute minor.
-
#patch ⇒ Object
Returns the value of attribute patch.
Instance Method Summary collapse
Instance Attribute Details
#major ⇒ Object
Returns the value of attribute major
6 7 8 |
# File 'lib/release_tagger.rb', line 6 def major @major end |
#minor ⇒ Object
Returns the value of attribute minor
6 7 8 |
# File 'lib/release_tagger.rb', line 6 def minor @minor end |
#patch ⇒ Object
Returns the value of attribute patch
6 7 8 |
# File 'lib/release_tagger.rb', line 6 def patch @patch end |
Instance Method Details
#bump(type) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/release_tagger.rb', line 7 def bump(type) raise ArgumentError, "Could not bump #{type} version" unless respond_to?(type) numbers = case type when "major" then [major + 1, 0, 0] when "minor" then [major, minor + 1, 0] when "patch" then [major, minor, patch + 1] end self.class.new(*numbers) end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/release_tagger.rb', line 21 def to_s [major, minor, patch].join(".") end |