lib/contrast/config/exception_configuration.rb in contrast-agent-5.3.0 vs lib/contrast/config/exception_configuration.rb in contrast-agent-6.0.0

- old
+ new

@@ -6,70 +6,23 @@ # 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. class ExceptionConfiguration < BaseConfiguration # @return [Integer] the HTTP status code override - attr_reader :override_status + attr_accessor :override_status # @return [String] the message text override - attr_reader :override_message + attr_accessor :override_message + attr_writer :capture def initialize hsh = {} @capture = traverse_config(hsh, :capture) @override_status = traverse_config(hsh, :override_status) @override_message = traverse_config(hsh, :override_message) - @configuration_map = {} - build_configuration_map end - # @return [Boolean] default: false + # @return [Boolean, false] def capture - @capture.nil? ? false : @capture - end - - def capture= value - self['capture'] = value - end - - def override_status= value - self['override_status'] = value - end - - def override_message= value - self['override_message'] = value - end - - # TODO: RUBY-1493 MOVE TO BASE CONFIG - - def []= key, value - instance_variable_set("@#{ key }".to_sym, value) - @configuration_map[key] = value - end - - def [] key - send(key.to_sym) - end - - # Traverse the given entity to build out the configuration graph. - # - # The values will be either a hash, indicating internal nodes to - # traverse, or a value to set or the EMPTY_VALUE symbol, indicating a - # leaf node. - # - # The spec_key are the Contrast defined keys based on the instance variables of - # a given configuration. - def traverse_config values, spec_key - internal_nodes = values.cs__respond_to?(:has_key?) - val = internal_nodes ? value_from_key_config(spec_key, values) : nil - val == EMPTY_VALUE ? nil : val - end - - def build_configuration_map - instance_variables.each do |key| - str_key = key.to_s.tr('@', '') - next if str_key == 'configuration_map' - - @configuration_map[str_key] = send(str_key.to_sym) - end + !!@capture end end end end