Sha256: d55e63a8e0edd1fffea1934244fe1e598eb01f42dafa7e80bad3d9a6fb3dd546

Contents?: true

Size: 887 Bytes

Versions: 1

Compression:

Stored size: 887 Bytes

Contents

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

module Contrast
  module Config
    # Common Configuration settings. Those in this section pertain to the
    # disabled assess rule functionality of the Agent.
    class AssessRulesConfiguration < BaseConfiguration
      SPEC_KEY = :disabled_rules.cs__freeze
      # @return [Array, nil] list of disabled assess rules
      attr_accessor :disabled_rules

      def initialize hsh = {}
        @disabled_rules = cast_disabled_rules hsh
      end

      private

      def cast_disabled_rules hsh
        return unless hsh
        return unless hsh.key?(SPEC_KEY)
        return hsh[SPEC_KEY] if hsh[SPEC_KEY].cs__is_a?(Array)

        hsh[SPEC_KEY].split(',').map(&:strip) if hsh[SPEC_KEY].cs__is_a?(String)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
contrast-agent-6.0.0 lib/contrast/config/assess_rules_configuration.rb