Class: Ghundle::HookVersion

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/ghundle/hook_version.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#majorObject (readonly)

Returns the value of attribute major.



3
4
5
# File 'lib/ghundle/hook_version.rb', line 3

def major
  @major
end

#minorObject (readonly)

Returns the value of attribute minor.



3
4
5
# File 'lib/ghundle/hook_version.rb', line 3

def minor
  @minor
end

#patchObject (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_sObject



9
10
11
# File 'lib/ghundle/hook_version.rb', line 9

def to_s
  "#{major}.#{minor}.#{patch}"
end