Class: Chef::Provider::Package::Yum::RPMVersion
- Inherits:
-
Object
- Object
- Chef::Provider::Package::Yum::RPMVersion
- Includes:
- Comparable
- Defined in:
- lib/chef/provider/package/yum.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.
234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/chef/provider/package/yum.rb', line 234 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.
246 247 248 |
# File 'lib/chef/provider/package/yum.rb', line 246 def e @e end |
#r ⇒ Object (readonly) Also known as: release
Returns the value of attribute r.
246 247 248 |
# File 'lib/chef/provider/package/yum.rb', line 246 def r @r end |
#v ⇒ Object (readonly) Also known as: version
Returns the value of attribute v.
246 247 248 |
# File 'lib/chef/provider/package/yum.rb', line 246 def v @v end |
Class Method Details
.parse(*args) ⇒ Object
251 252 253 |
# File 'lib/chef/provider/package/yum.rb', line 251 def self.parse(*args) self.new(*args) end |
Instance Method Details
#<=>(y) ⇒ Object
255 256 257 |
# File 'lib/chef/provider/package/yum.rb', line 255 def <=>(y) compare_versions(y) end |
#compare(y) ⇒ Object
259 260 261 |
# File 'lib/chef/provider/package/yum.rb', line 259 def compare(y) compare_versions(y, false) end |
#evr ⇒ Object
276 277 278 |
# File 'lib/chef/provider/package/yum.rb', line 276 def evr "#{@e}:#{@v}-#{@r}" end |
#partial_compare(y) ⇒ Object
263 264 265 |
# File 'lib/chef/provider/package/yum.rb', line 263 def partial_compare(y) compare_versions(y, true) end |
#to_s ⇒ Object
RPM::Version rpm_version_to_s equivalent
268 269 270 271 272 273 274 |
# File 'lib/chef/provider/package/yum.rb', line 268 def to_s if @r.nil? @v else "#{@v}-#{@r}" end end |