Class: Inspec::Resources::Packages

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/packages.rb

Defined Under Namespace

Classes: Package

Instance Method Summary collapse

Constructor Details

#initialize(pattern) ⇒ Packages

Returns a new instance of Packages.



25
26
27
28
29
30
31
# File 'lib/resources/packages.rb', line 25

def initialize(pattern)
  @pattern = pattern_regexp(pattern)
  all_pkgs = package_list
  @list = all_pkgs.find_all do |hm|
    hm[:name] =~ pattern_regexp(pattern)
  end
end

Instance Method Details

#to_sObject



33
34
35
# File 'lib/resources/packages.rb', line 33

def to_s
  "Packages #{@pattern.class == String ? @pattern : @pattern.inspect}"
end