Class: Chef::Provider::Package::Zypper::Version
- Inherits:
-
Object
- Object
- Chef::Provider::Package::Zypper::Version
- Defined in:
- lib/chef/provider/package/zypper/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
- #name_with_arch ⇒ Object
- #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/zypper/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/zypper/version.rb', line 27 def arch @arch end |
#name ⇒ Object
Returns the value of attribute name.
25 26 27 |
# File 'lib/chef/provider/package/zypper/version.rb', line 25 def name @name end |
#version ⇒ Object
Returns the value of attribute version.
26 27 28 |
# File 'lib/chef/provider/package/zypper/version.rb', line 26 def version @version end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
51 52 53 |
# File 'lib/chef/provider/package/zypper/version.rb', line 51 def ==(other) name == other.name && version == other.version && arch == other.arch end |
#matches_name_and_arch?(other) ⇒ Boolean
47 48 49 |
# File 'lib/chef/provider/package/zypper/version.rb', line 47 def matches_name_and_arch?(other) other.version == version && other.arch == arch end |
#name_with_arch ⇒ Object
43 44 45 |
# File 'lib/chef/provider/package/zypper/version.rb', line 43 def name_with_arch "#{name}.#{arch}" unless name.nil? end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/chef/provider/package/zypper/version.rb', line 35 def to_s "#{name}-#{version}.#{arch}" unless version.nil? end |
#version_with_arch ⇒ Object
39 40 41 |
# File 'lib/chef/provider/package/zypper/version.rb', line 39 def version_with_arch "#{version}.#{arch}" unless version.nil? end |