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.
14 15 16 |
# File 'lib/puppet/util/package/version/rpm.rb', line 14 def arch @arch end |
#epoch ⇒ Object (readonly)
Returns the value of attribute epoch.
14 15 16 |
# File 'lib/puppet/util/package/version/rpm.rb', line 14 def epoch @epoch end |
#release ⇒ Object (readonly)
Returns the value of attribute release.
14 15 16 |
# File 'lib/puppet/util/package/version/rpm.rb', line 14 def release @release end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
14 15 16 |
# File 'lib/puppet/util/package/version/rpm.rb', line 14 def version @version end |
Class Method Details
.parse(ver) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/puppet/util/package/version/rpm.rb', line 16 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
41 42 43 44 45 |
# File 'lib/puppet/util/package/version/rpm.rb', line 41 def <=>(other) raise ArgumentError, _("Cannot compare, as %{other} is not a Rpm Version") % { other: other } unless other.is_a?(self.class) rpm_compare_evr(to_s, other.to_s) end |
#eql?(other) ⇒ Boolean Also known as: ==
32 33 34 35 36 37 38 |
# File 'lib/puppet/util/package/version/rpm.rb', line 32 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
23 24 25 26 27 28 29 |
# File 'lib/puppet/util/package/version/rpm.rb', line 23 def to_s version_found = ''.dup version_found += "#{@epoch}:" if @epoch version_found += @version version_found += "-#{@release}" if @release version_found end |