Class: Contrast::Config::ExceptionConfiguration

Inherits:
Object
  • Object
show all
Includes:
Contrast::Components::ComponentBase, BaseConfiguration
Defined in:
lib/contrast/config/exception_configuration.rb

Overview

Common Configuration settings. Those in this section pertain to the exception handling in Ruby, allowing for the override of Response Code and Message when Security Exceptions are raised.

Constant Summary collapse

CANON_NAME =
'agent.ruby.exception'
CONFIG_VALUES =
%w[capture override_status override_message].cs__freeze

Constants included from Contrast::Components::ComponentBase

Contrast::Components::ComponentBase::ENABLE

Constants included from Diagnostics::Tools

Diagnostics::Tools::CHECK

Constants included from Diagnostics::SingletonTools

Diagnostics::SingletonTools::API_CREDENTIALS, Diagnostics::SingletonTools::CONTRAST_MARK

Constants included from BaseConfiguration

BaseConfiguration::AT_UNDERSCORE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Contrast::Components::ComponentBase

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

Methods included from Diagnostics::Tools

#add_effective_config_values, #add_single_effective_value

Methods included from Diagnostics::SingletonTools

#flatten_settings, #to_config_values, #update_config, #value_to_s

Methods included from BaseConfiguration

#to_contrast_hash

Constructor Details

#initialize(hsh = {}) ⇒ ExceptionConfiguration

Returns a new instance of ExceptionConfiguration.



27
28
29
30
31
32
33
34
35
# File 'lib/contrast/config/exception_configuration.rb', line 27

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

  @capture = hsh[:capture]
  @override_status = hsh[:override_status]
  @override_message = hsh[:override_message]
end

Instance Attribute Details

#canon_nameString (readonly)

Returns:



23
24
25
# File 'lib/contrast/config/exception_configuration.rb', line 23

def canon_name
  @canon_name
end

#captureBoolean, false

Returns:

  • (Boolean, false)


38
39
40
# File 'lib/contrast/config/exception_configuration.rb', line 38

def capture
  !!@capture
end

#config_valuesArray (readonly)

Returns:

  • (Array)


25
26
27
# File 'lib/contrast/config/exception_configuration.rb', line 25

def config_values
  @config_values
end

#override_messageString

Returns the message text override.

Returns:

  • (String)

    the message text override



20
21
22
# File 'lib/contrast/config/exception_configuration.rb', line 20

def override_message
  @override_message
end

#override_statusInteger

Returns the HTTP status code override.

Returns:

  • (Integer)

    the HTTP status code override



18
19
20
# File 'lib/contrast/config/exception_configuration.rb', line 18

def override_status
  @override_status
end