Class: GitVersionBumper::VersionBumper::Tag
- Inherits:
-
Object
- Object
- GitVersionBumper::VersionBumper::Tag
- Includes:
- Comparable
- Defined in:
- lib/git_version_bumper/version_bumper/tag.rb
Overview
Local represenation of Git::Object::Tag Created to allow for custom sorting of git tags
Instance Attribute Summary collapse
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(major, minor, patch) ⇒ Tag
constructor
A new instance of Tag.
- #to_s ⇒ Object
Constructor Details
#initialize(major, minor, patch) ⇒ Tag
Returns a new instance of Tag.
10 11 12 13 14 |
# File 'lib/git_version_bumper/version_bumper/tag.rb', line 10 def initialize(major, minor, patch) @major = Integer(major) @minor = Integer(minor) @patch = Integer(patch) end |
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
8 9 10 |
# File 'lib/git_version_bumper/version_bumper/tag.rb', line 8 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
8 9 10 |
# File 'lib/git_version_bumper/version_bumper/tag.rb', line 8 def minor @minor end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
8 9 10 |
# File 'lib/git_version_bumper/version_bumper/tag.rb', line 8 def patch @patch end |
Class Method Details
Instance Method Details
#<=>(other) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/git_version_bumper/version_bumper/tag.rb', line 37 def <=>(other) if major == other.major if minor == other.minor patch <=> other.patch else minor <=> other.minor end else major <=> other.major end end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/git_version_bumper/version_bumper/tag.rb', line 33 def to_s "v#{major}.#{minor}.#{patch}" end |