Class: Chef::Provider::Package::Yum::Version

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/provider/package/yum/version.rb

Overview

helper class to assist in passing around name/version/arch triples

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version, arch) ⇒ Version

Returns a new instance of Version.



29
30
31
32
33
# File 'lib/chef/provider/package/yum/version.rb', line 29

def initialize(name, version, arch)
  @name    = name
  @version = version
  @arch    = arch
end

Instance Attribute Details

#archObject

Returns the value of attribute arch.



27
28
29
# File 'lib/chef/provider/package/yum/version.rb', line 27

def arch
  @arch
end

#nameObject

Returns the value of attribute name.



25
26
27
# File 'lib/chef/provider/package/yum/version.rb', line 25

def name
  @name
end

#versionObject

Returns the value of attribute version.



26
27
28
# File 'lib/chef/provider/package/yum/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/yum/version.rb', line 51

def ==(other)
  name == other.name && version == other.version && arch == other.arch
end

#matches_name_and_arch?(other) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/chef/provider/package/yum/version.rb', line 47

def matches_name_and_arch?(other)
  other.version == version && other.arch == arch
end

#name_with_archObject



43
44
45
# File 'lib/chef/provider/package/yum/version.rb', line 43

def name_with_arch
  "#{name}.#{arch}" unless name.nil?
end

#to_sObject



35
36
37
# File 'lib/chef/provider/package/yum/version.rb', line 35

def to_s
  "#{name}-#{version}.#{arch}" unless version.nil?
end

#version_with_archObject



39
40
41
# File 'lib/chef/provider/package/yum/version.rb', line 39

def version_with_arch
  "#{version}.#{arch}" unless version.nil?
end