Sha256: 71724ab35fa1d78f90f619f7f2b9457fa131426abaded80f21d03b8a8e0b9dc8

Contents?: true

Size: 896 Bytes

Versions: 8

Compression:

Stored size: 896 Bytes

Contents

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

require 'forwardable'
require 'contrast/utils/object_share'

module Contrast
  module Config
    # This is the base for our configuration classes. It is intended to facilitate the translation of the Common
    # Configuration settings to usable Ruby classes.
    module BaseConfiguration
      extend Forwardable
      AT_UNDERSCORE = '@_'

      def to_hash
        hsh = {}
        instance_variables.each do |iv|
          # strip the '@' of '@_' to get the key
          string_iv = iv.to_s
          key = if string_iv.include?(AT_UNDERSCORE)
                  string_iv[2..]
                else
                  string_iv[1..]
                end
          hsh[key] = send(key.to_sym)
        end
        hsh
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
contrast-agent-6.6.5 lib/contrast/config/base_configuration.rb
contrast-agent-6.6.4 lib/contrast/config/base_configuration.rb
contrast-agent-6.6.3 lib/contrast/config/base_configuration.rb
contrast-agent-6.6.2 lib/contrast/config/base_configuration.rb
contrast-agent-6.6.1 lib/contrast/config/base_configuration.rb
contrast-agent-6.6.0 lib/contrast/config/base_configuration.rb
contrast-agent-6.5.1 lib/contrast/config/base_configuration.rb
contrast-agent-6.5.0 lib/contrast/config/base_configuration.rb