Class: ConfigCurator::PackageLookup
- Inherits:
-
Object
- Object
- ConfigCurator::PackageLookup
- Defined in:
- lib/config_curator/package_lookup.rb
Overview
Defined Under Namespace
Classes: LookupFailed
Constant Summary collapse
- TOOLS =
Default list of supported package tools.
%i(dpkg pacman)
Instance Attribute Summary collapse
-
#tool ⇒ Symbol
The package tool to use for this instance.
-
#tools ⇒ Array
Package tools that support package lookup ordered by preference.
Instance Method Summary collapse
-
#initialize(tool: nil) ⇒ PackageLookup
constructor
A new instance of PackageLookup.
-
#installed?(package) ⇒ Boolean
Checks if package is installed.
Constructor Details
#initialize(tool: nil) ⇒ PackageLookup
Returns a new instance of PackageLookup.
23 24 25 |
# File 'lib/config_curator/package_lookup.rb', line 23 def initialize tool: nil self.tool = tool end |
Instance Attribute Details
#tool ⇒ Symbol
The package tool to use for this instance.
35 36 37 |
# File 'lib/config_curator/package_lookup.rb', line 35 def tool @tool end |
#tools ⇒ Array
Package tools that support package lookup ordered by preference.
29 30 31 |
# File 'lib/config_curator/package_lookup.rb', line 29 def tools @tools end |
Instance Method Details
#installed?(package) ⇒ Boolean
Checks if package is installed.
49 50 51 52 |
# File 'lib/config_curator/package_lookup.rb', line 49 def installed? package fail LookupFailed, 'No supported package tool found.' if tool.nil? send tool, package end |