class ForemanFogProxmox::Semver::SemverClass

Attributes

major[RW]
minor[RW]
patch[RW]
qualifier[RW]

Public Class Methods

new(major, minor, patch, qualifier = '') click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 29
def initialize(major, minor, patch, qualifier = '')
  @major = major.to_i
  @minor = minor.to_i
  @patch = patch.to_i
  @qualifier = qualifier.nil? ? '' : qualifier
end

Public Instance Methods

<(other) click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 51
def <(other)
  raise TypeError unless other.is_a?(SemverClass)

  result = @major < other.major
  result = @minor < other.minor if @major == other.major
  result = @patch < other.patch if @minor == other.minor && @major == other.major
  result
end
<=(other) click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 42
def <=(other)
  raise TypeError unless other.is_a?(SemverClass)

  result = @major <= other.major
  result = @minor <= other.minor if @major == other.major
  result = @patch <= other.patch if @minor == other.minor && @major == other.major
  result
end
==(other) click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 78
def ==(other)
  raise TypeError unless other.is_a?(SemverClass)

  @major == other.major && @minor == other.minor && @patch == other.patch && @qualifier == other.qualifier
end
>(other) click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 60
def >(other)
  raise TypeError unless other.is_a?(SemverClass)

  result = @major > other.major
  result = @minor > other.minor if @major == other.major
  result = @patch > other.patch if @minor == other.minor && @major == other.major
  result
end
>=(other) click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 69
def >=(other)
  raise TypeError unless other.is_a?(SemverClass)

  result = @major >= other.major
  result = @minor >= other.minor if @major == other.major
  result = @patch >= other.patch if @minor == other.minor && @major == other.major
  result
end
to_s() click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 36
def to_s
  flat = "#{major}.#{minor}.#{patch}"
  flat += "-#{qualifier}" unless qualifier == ''
  flat
end