Class: Chef::Provider::Package::Dnf::Version
- Inherits:
-
Object
- Object
- Chef::Provider::Package::Dnf::Version
- Defined in:
- lib/chef/provider/package/dnf/version.rb
Overview
helper class to assist in passing around name/version/arch triples
Instance Attribute Summary collapse
-
#arch ⇒ Object
Returns the value of attribute arch.
-
#name ⇒ Object
Returns the value of attribute name.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#initialize(name, version, arch) ⇒ Version
constructor
A new instance of Version.
- #matches_name_and_arch?(other) ⇒ Boolean
- #to_s ⇒ Object
- #version_with_arch ⇒ Object
Constructor Details
#initialize(name, version, arch) ⇒ Version
Returns a new instance of Version.
29 30 31 32 33 |
# File 'lib/chef/provider/package/dnf/version.rb', line 29 def initialize(name, version, arch) @name = name @version = version @arch = arch end |
Instance Attribute Details
#arch ⇒ Object
Returns the value of attribute arch.
27 28 29 |
# File 'lib/chef/provider/package/dnf/version.rb', line 27 def arch @arch end |
#name ⇒ Object
Returns the value of attribute name.
25 26 27 |
# File 'lib/chef/provider/package/dnf/version.rb', line 25 def name @name end |
#version ⇒ Object
Returns the value of attribute version.
26 27 28 |
# File 'lib/chef/provider/package/dnf/version.rb', line 26 def version @version end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
47 48 49 |
# File 'lib/chef/provider/package/dnf/version.rb', line 47 def ==(other) name == other.name && version == other.version && arch == other.arch end |
#matches_name_and_arch?(other) ⇒ Boolean
43 44 45 |
# File 'lib/chef/provider/package/dnf/version.rb', line 43 def matches_name_and_arch?(other) other.version == version && other.arch == arch end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/chef/provider/package/dnf/version.rb', line 35 def to_s "#{name}-#{version}.#{arch}" end |
#version_with_arch ⇒ Object
39 40 41 |
# File 'lib/chef/provider/package/dnf/version.rb', line 39 def version_with_arch "#{version}.#{arch}" unless version.nil? end |