Class: Inspec::Plugin::V2::PluginFilter

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/inspec/plugin/v2/filter.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePluginFilter

Returns a new instance of PluginFilter.



10
11
12
# File 'lib/inspec/plugin/v2/filter.rb', line 10

def initialize
  read_filter_data
end

Class Method Details

.exclude?(plugin_name) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/inspec/plugin/v2/filter.rb', line 14

def self.exclude?(plugin_name)
  instance.exclude?(plugin_name)
end

Instance Method Details

#exclude?(plugin_name) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
# File 'lib/inspec/plugin/v2/filter.rb', line 18

def exclude?(plugin_name)
  # Currently, logic is very simple: is there an exact match?
  # In the future, we might add regexes on names, or exclude version ranges
  return false unless @filter_data[:exclude].detect { |e| e.plugin_name == plugin_name }

  # OK, return entire data structure.
  @filter_data[:exclude].detect { |e| e.plugin_name == plugin_name }
end