Class: Ghundle::HookVersion
- Inherits:
-
Object
- Object
- Ghundle::HookVersion
- Includes:
- Comparable
- Defined in:
- lib/ghundle/hook_version.rb
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.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(string) ⇒ HookVersion
constructor
A new instance of HookVersion.
- #to_s ⇒ Object
Constructor Details
#initialize(string) ⇒ HookVersion
Returns a new instance of HookVersion.
5 6 7 |
# File 'lib/ghundle/hook_version.rb', line 5 def initialize(string) @major, @minor, @patch = string.split('.').map(&:to_i) end |
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
3 4 5 |
# File 'lib/ghundle/hook_version.rb', line 3 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
3 4 5 |
# File 'lib/ghundle/hook_version.rb', line 3 def minor @minor end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
3 4 5 |
# File 'lib/ghundle/hook_version.rb', line 3 def patch @patch end |
Instance Method Details
#<=>(other) ⇒ Object
19 20 21 |
# File 'lib/ghundle/hook_version.rb', line 19 def <=>(other) to_s <=> other.to_s end |
#==(other) ⇒ Object
13 14 15 |
# File 'lib/ghundle/hook_version.rb', line 13 def ==(other) to_s == other.to_s end |
#to_s ⇒ Object
9 10 11 |
# File 'lib/ghundle/hook_version.rb', line 9 def to_s "#{major}.#{minor}.#{patch}" end |