Class: Hackle::CoreVersion
- Inherits:
-
Object
- Object
- Hackle::CoreVersion
- Includes:
- Comparable
- Defined in:
- lib/hackle/internal/model/version.rb
Instance Attribute Summary collapse
- #major ⇒ Integer readonly
- #minor ⇒ Integer readonly
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(major:, minor:, patch:) ⇒ CoreVersion
constructor
A new instance of CoreVersion.
- #to_s ⇒ Object
Constructor Details
#initialize(major:, minor:, patch:) ⇒ CoreVersion
Returns a new instance of CoreVersion.
76 77 78 79 80 |
# File 'lib/hackle/internal/model/version.rb', line 76 def initialize(major:, minor:, patch:) @major = major @minor = minor @patch = patch end |
Instance Attribute Details
#major ⇒ Integer (readonly)
71 72 73 |
# File 'lib/hackle/internal/model/version.rb', line 71 def major @major end |
#minor ⇒ Integer (readonly)
71 |
# File 'lib/hackle/internal/model/version.rb', line 71 attr_reader :major, :minor, :patch |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
71 |
# File 'lib/hackle/internal/model/version.rb', line 71 attr_reader :major, :minor, :patch |
Instance Method Details
#<=>(other) ⇒ Object
82 83 84 85 86 |
# File 'lib/hackle/internal/model/version.rb', line 82 def <=>(other) return nil unless other.is_a?(CoreVersion) [major, minor, patch] <=> [other.major, other.minor, other.patch] end |
#==(other) ⇒ Object
88 89 90 |
# File 'lib/hackle/internal/model/version.rb', line 88 def ==(other) other.is_a?(CoreVersion) && (major == other.major && minor == other.minor && patch == other.patch) end |
#to_s ⇒ Object
92 93 94 |
# File 'lib/hackle/internal/model/version.rb', line 92 def to_s "#{major}.#{minor}.#{patch}" end |