Sha256: f657d1564b513fd750257b816f609c8f17ee508225f03920f0ab92100b9a18fc
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/components/logger' module Contrast module Utils # This is the TelemetryHash, which will take data type, so we can push freely, without worrying about # validating the event before that class TelemetryHash < Hash include Contrast::Components::Logger::InstanceMethods attr_reader :data_type def initialize data_type, *_several_variants super() @data_type = data_type end def []= key, value return unless valid_value?(value) super(key, value) end def increment key self[key].exceptions[0].increment_occurrences :incremented! end def valid_value? value unless value.cs__is_a?(data_type) logger.debug('The following key will be omitted', value: value) return false end true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-6.1.2 | lib/contrast/utils/telemetry_hash.rb |
contrast-agent-6.1.1 | lib/contrast/utils/telemetry_hash.rb |