Sha256: 61f21c5b5e8b92a2d300821bf2532c860b50ae6b67378a860fb947381c01058e

Contents?: true

Size: 1.32 KB

Versions: 18

Compression:

Stored size: 1.32 KB

Contents

# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/components/base'

module Contrast
  module Components
    module Inventory
      # Interface component for Inventory settings used to store the values from
      # settings file and assert state with check methods.
      class Interface
        include Contrast::Components::ComponentBase

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

        attr_writer :tags
        # @return [String]
        attr_reader :canon_name
        # @return [Array]
        attr_reader :config_values

        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

        # return [Boolean]
        def enable
          @enable.nil? ? true : @enable
        end

        # return [Boolean]
        def analyze_libraries
          @analyze_libraries.nil? ? true : @analyze_libraries
        end

        # @return [String, nil] tags
        def tags
          stringify_array(@tags)
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
contrast-agent-7.6.1 lib/contrast/components/inventory.rb
contrast-agent-7.6.0 lib/contrast/components/inventory.rb
contrast-agent-7.5.0 lib/contrast/components/inventory.rb
contrast-agent-7.4.1 lib/contrast/components/inventory.rb
contrast-agent-7.4.0 lib/contrast/components/inventory.rb
contrast-agent-7.3.2 lib/contrast/components/inventory.rb
contrast-agent-7.3.1 lib/contrast/components/inventory.rb
contrast-agent-7.3.0 lib/contrast/components/inventory.rb
contrast-agent-7.2.0 lib/contrast/components/inventory.rb
contrast-agent-7.1.0 lib/contrast/components/inventory.rb
contrast-agent-7.0.0 lib/contrast/components/inventory.rb
contrast-agent-6.15.3 lib/contrast/components/inventory.rb
contrast-agent-6.15.2 lib/contrast/components/inventory.rb
contrast-agent-6.15.1 lib/contrast/components/inventory.rb
contrast-agent-6.15.0 lib/contrast/components/inventory.rb
contrast-agent-6.14.0 lib/contrast/components/inventory.rb
contrast-agent-6.13.0 lib/contrast/components/inventory.rb
contrast-agent-6.12.0 lib/contrast/components/inventory.rb