Class: Contrast::Components::Inventory::Interface

Inherits:
Object
  • Object
show all
Includes:
ComponentBase
Defined in:
lib/contrast/components/inventory.rb

Overview

Interface component for Inventory settings used to store the values from settings file and assert state with check methods.

Constant Summary collapse

CANON_NAME =
'inventory'
CONFIG_VALUES =
%w[enable analyze_libraries tags].cs__freeze

Constants included from ComponentBase

ComponentBase::ENABLE

Constants included from Contrast::Config::Diagnostics::Tools

Contrast::Config::Diagnostics::Tools::CHECK

Constants included from Contrast::Config::Diagnostics::SingletonTools

Contrast::Config::Diagnostics::SingletonTools::API_CREDENTIALS, Contrast::Config::Diagnostics::SingletonTools::CONTRAST_MARK

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ComponentBase

#false?, #file_exists?, #stringify_array, #to_effective_config, #true?, #valid_cert?

Methods included from Contrast::Config::Diagnostics::Tools

#add_effective_config_values, #add_single_effective_value

Methods included from Contrast::Config::Diagnostics::SingletonTools

#flatten_settings, #to_config_values, #update_config, #value_to_s

Constructor Details

#initialize(hsh = {}) ⇒ Interface

Returns a new instance of Interface.



23
24
25
26
27
28
29
30
31
# File 'lib/contrast/components/inventory.rb', line 23

def initialize hsh = {}
  @config_values = CONFIG_VALUES
  @canon_name = CANON_NAME
  return unless hsh

  @enable = !false?(hsh[:enable])
  @analyze_libraries = !false?(hsh[:analyze_libraries])
  @tags = hsh[:tags]
end

Instance Attribute Details

#canon_nameString (readonly)

Returns:



19
20
21
# File 'lib/contrast/components/inventory.rb', line 19

def canon_name
  @canon_name
end

#config_valuesArray (readonly)

Returns:

  • (Array)


21
22
23
# File 'lib/contrast/components/inventory.rb', line 21

def config_values
  @config_values
end

#tagsString?

Returns tags.

Returns:



44
45
46
# File 'lib/contrast/components/inventory.rb', line 44

def tags
  stringify_array(@tags)
end

Instance Method Details

#analyze_librariesObject

return [Boolean]



39
40
41
# File 'lib/contrast/components/inventory.rb', line 39

def analyze_libraries
  @analyze_libraries.nil? ? true : @analyze_libraries
end

#enableObject

return [Boolean]



34
35
36
# File 'lib/contrast/components/inventory.rb', line 34

def enable
  @enable.nil? ? true : @enable
end