Class: Debian::AptPkg::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/debian/apt_pkg/package.rb

Overview

Debian::AptPkg::Package class Representation of a package in a cache

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name, full_name, arch, essential, important, current_version) ⇒ Package

Initialize the Package class

Examples:

new(id, name, full_name, arch, essential, important, current_version)

Parameters:

  • The (Integer)

    numeric ID of the package

  • The (String)

    name of the package

  • Get (String)

    the full name of the package, including the architecture

  • The (String)

    architecture of the package

  • Boolean (Boolean)

    value determining whether the package is essential

  • Boolean (Boolean)

    value determining whether the package has the ‘important’ flag set (‘Important: yes’ in the Packages file)

  • The (Version, NilClass)

    version of the package currently installed or ‘nil`



28
29
30
31
32
33
34
35
36
# File 'lib/debian/apt_pkg/package.rb', line 28

def initialize(id, name, full_name, arch, essential, important, current_version)
  @id = id
  @name = name
  @full_name = full_name
  @arch = arch
  @essential = essential
  @important = important
  @current_version = current_version
end

Instance Attribute Details

#archObject

Returns the value of attribute arch.



9
10
11
# File 'lib/debian/apt_pkg/package.rb', line 9

def arch
  @arch
end

#current_versionObject

Returns the value of attribute current_version.



9
10
11
# File 'lib/debian/apt_pkg/package.rb', line 9

def current_version
  @current_version
end

#essentialObject

Returns the value of attribute essential.



9
10
11
# File 'lib/debian/apt_pkg/package.rb', line 9

def essential
  @essential
end

#full_nameObject

Returns the value of attribute full_name.



9
10
11
# File 'lib/debian/apt_pkg/package.rb', line 9

def full_name
  @full_name
end

#idObject

Returns the value of attribute id.



9
10
11
# File 'lib/debian/apt_pkg/package.rb', line 9

def id
  @id
end

#importantObject

Returns the value of attribute important.



9
10
11
# File 'lib/debian/apt_pkg/package.rb', line 9

def important
  @important
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/debian/apt_pkg/package.rb', line 9

def name
  @name
end

Instance Method Details

#is_installedBoolean

Return ‘true` if the package is installed

Returns:

  • (Boolean)


40
41
42
43
44
# File 'lib/debian/apt_pkg/package.rb', line 40

def is_installed
  return false unless current_version

  true
end