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 26
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 48
def <(other)
    raise TypeError unless other.is_a?(SemverClass)
    if @major == other.major
        if @minor == other.minor
            return @patch < other.patch
        else
            return @minor < other.minor
        end
    else
        return @major < other.major
    end
end
<=(other) click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 36
def <=(other)
    raise TypeError unless other.is_a?(SemverClass)
    if @major == other.major
        if @minor == other.minor
            return @patch <= other.patch
        else
            return @minor <= other.minor
        end
    else
        return @major <= other.major
    end
end
==(other) click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 84
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)
    if @major == other.major
        if @minor == other.minor
            return @patch > other.patch
        else
            return @minor > other.minor
        end
    else
        return @major > other.major
    end
end
>=(other) click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 72
def >=(other)
    raise TypeError unless other.is_a?(SemverClass)
    if @major == other.major
        if @minor == other.minor
            return @patch >= other.patch
        else
            return @minor >= other.minor
        end
    else
        return @major >= other.major
    end
end
to_s() click to toggle source
# File lib/foreman_fog_proxmox/semver.rb, line 32
def to_s
    flat = "#{major}.#{minor}.#{patch}"
    flat += "-#{qualifier}" unless qualifier == ''
end