Class: Chef::Provider::Package::Yum::RPMVersion
- Inherits:
-
Object
- Object
- Chef::Provider::Package::Yum::RPMVersion
- Includes:
- Comparable
- Defined in:
- lib/chef/provider/package/yum/rpm_utils.rb
Overview
RPMUtils
Instance Attribute Summary collapse
-
#e ⇒ Object
(also: #epoch)
readonly
Returns the value of attribute e.
-
#r ⇒ Object
(also: #release)
readonly
Returns the value of attribute r.
-
#v ⇒ Object
(also: #version)
readonly
Returns the value of attribute v.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(y) ⇒ Object
- #compare(y) ⇒ Object
- #evr ⇒ Object
-
#initialize(*args) ⇒ RPMVersion
constructor
A new instance of RPMVersion.
- #partial_compare(y) ⇒ Object
-
#to_s ⇒ Object
RPM::Version rpm_version_to_s equivalent.
Constructor Details
#initialize(*args) ⇒ RPMVersion
Returns a new instance of RPMVersion.
225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/chef/provider/package/yum/rpm_utils.rb', line 225 def initialize(*args) if args.size == 1 @e, @v, @r = RPMUtils.version_parse(args[0]) elsif args.size == 3 @e = args[0].to_i @v = args[1] @r = args[2] else raise ArgumentError, "Expecting either 'epoch-version-release' or 'epoch, " + "version, release'" end end |
Instance Attribute Details
#e ⇒ Object (readonly) Also known as: epoch
Returns the value of attribute e.
237 238 239 |
# File 'lib/chef/provider/package/yum/rpm_utils.rb', line 237 def e @e end |
#r ⇒ Object (readonly) Also known as: release
Returns the value of attribute r.
237 238 239 |
# File 'lib/chef/provider/package/yum/rpm_utils.rb', line 237 def r @r end |
#v ⇒ Object (readonly) Also known as: version
Returns the value of attribute v.
237 238 239 |
# File 'lib/chef/provider/package/yum/rpm_utils.rb', line 237 def v @v end |
Class Method Details
.parse(*args) ⇒ Object
242 243 244 |
# File 'lib/chef/provider/package/yum/rpm_utils.rb', line 242 def self.parse(*args) self.new(*args) end |
Instance Method Details
#<=>(y) ⇒ Object
246 247 248 |
# File 'lib/chef/provider/package/yum/rpm_utils.rb', line 246 def <=>(y) compare_versions(y) end |
#compare(y) ⇒ Object
250 251 252 |
# File 'lib/chef/provider/package/yum/rpm_utils.rb', line 250 def compare(y) compare_versions(y, false) end |
#evr ⇒ Object
267 268 269 |
# File 'lib/chef/provider/package/yum/rpm_utils.rb', line 267 def evr "#{@e}:#{@v}-#{@r}" end |
#partial_compare(y) ⇒ Object
254 255 256 |
# File 'lib/chef/provider/package/yum/rpm_utils.rb', line 254 def partial_compare(y) compare_versions(y, true) end |
#to_s ⇒ Object
RPM::Version rpm_version_to_s equivalent
259 260 261 262 263 264 265 |
# File 'lib/chef/provider/package/yum/rpm_utils.rb', line 259 def to_s if @r.nil? @v else "#{@v}-#{@r}" end end |