Class: Puppet::Util::Package::Version::Rpm Private

Inherits:
Numeric
  • Object
show all
Extended by:
RpmCompare
Includes:
Comparable, RpmCompare
Defined in:
lib/puppet/util/package/version/rpm.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: ValidationFailure

Constant Summary

Constants included from RpmCompare

RpmCompare::ARCH_LIST, RpmCompare::ARCH_REGEX

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RpmCompare

compare_values, rpm_parse_evr, rpmvercmp

Instance Attribute Details

#archObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


13
14
15
# File 'lib/puppet/util/package/version/rpm.rb', line 13

def arch
  @arch
end

#epochObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


13
14
15
# File 'lib/puppet/util/package/version/rpm.rb', line 13

def epoch
  @epoch
end

#releaseObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


13
14
15
# File 'lib/puppet/util/package/version/rpm.rb', line 13

def release
  @release
end

#versionObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


13
14
15
# File 'lib/puppet/util/package/version/rpm.rb', line 13

def version
  @version
end

Class Method Details

.parse(ver) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:


15
16
17
18
19
# File 'lib/puppet/util/package/version/rpm.rb', line 15

def self.parse(ver)
  raise ValidationFailure unless ver.is_a?(String)
  version = rpm_parse_evr(ver)
  new(version[:epoch], version[:version], version[:release], version[:arch]).freeze
end

Instance Method Details

#<=>(other) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (ArgumentError)

39
40
41
42
43
# File 'lib/puppet/util/package/version/rpm.rb', line 39

def <=>(other)
  raise ArgumentError, _("Cannot compare, as %{other} is not a Rpm Version") % { other: other } unless other.is_a?(self.class)

  rpm_compareEVR(self.to_s, other.to_s)
end

#eql?(other) ⇒ Boolean Also known as: ==

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

30
31
32
33
34
35
36
# File 'lib/puppet/util/package/version/rpm.rb', line 30

def eql?(other)
  other.is_a?(self.class) &&
    @epoch.eql?(other.epoch) &&
    @version.eql?(other.version) &&
    @release.eql?(other.release) &&
    @arch.eql?(other.arch)
end

#to_sObject Also known as: inspect

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


21
22
23
24
25
26
27
# File 'lib/puppet/util/package/version/rpm.rb', line 21

def to_s
  version_found = ''
  version_found += "#{@epoch}:"   if @epoch
  version_found += @version
  version_found += "-#{@release}" if @release
  version_found
end