Class: Puppet::Util::Package::Version::Rpm
- Extended by:
- RpmCompare
- Includes:
- Comparable, RpmCompare
- Defined in:
- lib/puppet/util/package/version/rpm.rb
Defined Under Namespace
Classes: ValidationFailure
Constant Summary
Constants included from RpmCompare
RpmCompare::ARCH_LIST, RpmCompare::ARCH_REGEX
Instance Attribute Summary collapse
-
#arch ⇒ Object
readonly
Returns the value of attribute arch.
-
#epoch ⇒ Object
readonly
Returns the value of attribute epoch.
-
#release ⇒ Object
readonly
Returns the value of attribute release.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #to_s ⇒ Object (also: #inspect)
Methods included from RpmCompare
compare_values, rpm_parse_evr, rpmvercmp
Instance Attribute Details
#arch ⇒ Object (readonly)
Returns the value of attribute arch.
13 14 15 |
# File 'lib/puppet/util/package/version/rpm.rb', line 13 def arch @arch end |
#epoch ⇒ Object (readonly)
Returns the value of attribute epoch.
13 14 15 |
# File 'lib/puppet/util/package/version/rpm.rb', line 13 def epoch @epoch end |
#release ⇒ Object (readonly)
Returns the value of attribute release.
13 14 15 |
# File 'lib/puppet/util/package/version/rpm.rb', line 13 def release @release end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
13 14 15 |
# File 'lib/puppet/util/package/version/rpm.rb', line 13 def version @version end |
Class Method Details
.parse(ver) ⇒ Object
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
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: ==
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_s ⇒ Object Also known as: inspect
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 |