Class: 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.
231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/chef/provider/package/yum.rb', line 231 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.
243 244 245 |
# File 'lib/chef/provider/package/yum.rb', line 243 def e @e end |
#r ⇒ Object (readonly) Also known as: release
Returns the value of attribute r.
243 244 245 |
# File 'lib/chef/provider/package/yum.rb', line 243 def r @r end |
#v ⇒ Object (readonly) Also known as: version
Returns the value of attribute v.
243 244 245 |
# File 'lib/chef/provider/package/yum.rb', line 243 def v @v end |
Class Method Details
.parse(*args) ⇒ Object
248 249 250 |
# File 'lib/chef/provider/package/yum.rb', line 248 def self.parse(*args) self.new(*args) end |
Instance Method Details
#<=>(y) ⇒ Object
252 253 254 |
# File 'lib/chef/provider/package/yum.rb', line 252 def <=>(y) compare_versions(y) end |
#compare(y) ⇒ Object
256 257 258 |
# File 'lib/chef/provider/package/yum.rb', line 256 def compare(y) compare_versions(y, false) end |
#evr ⇒ Object
273 274 275 |
# File 'lib/chef/provider/package/yum.rb', line 273 def evr "#{@e}:#{@v}-#{@r}" end |
#partial_compare(y) ⇒ Object
260 261 262 |
# File 'lib/chef/provider/package/yum.rb', line 260 def partial_compare(y) compare_versions(y, true) end |
#to_s ⇒ Object
RPM::Version rpm_version_to_s equivalent
265 266 267 268 269 270 271 |
# File 'lib/chef/provider/package/yum.rb', line 265 def to_s if @r.nil? @v else "#{@v}-#{@r}" end end |