Class: Hackle::CoreVersion

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/hackle/internal/model/version.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(major:, minor:, patch:) ⇒ CoreVersion

Returns a new instance of CoreVersion.

Parameters:

  • major (Integer)
  • minor (Integer)
  • patch (Integer)


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

#majorInteger (readonly)

Returns:

  • (Integer)


71
72
73
# File 'lib/hackle/internal/model/version.rb', line 71

def major
  @major
end

#minorInteger (readonly)

Returns:

  • (Integer)


71
# File 'lib/hackle/internal/model/version.rb', line 71

attr_reader :major, :minor, :patch

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



92
93
94
# File 'lib/hackle/internal/model/version.rb', line 92

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