Module: Contrast::Agent::Reporting::ReportingStorage
- Extended by:
- Components::Logger::InstanceMethods
- Defined in:
- lib/contrast/agent/reporting/reporting_utilities/reporting_storage.rb
Overview
This module will be used to store everything that would be sent and depends on the response we receive
Class Method Summary collapse
- .[](key) ⇒ Object (also: get)
-
.[]=(key, value) ⇒ Object
(also: set)
The value we saved.
-
.collection ⇒ Object
So the collection will be used to store those events.
- .delete(key) ⇒ Object
-
.find_by_rule_id(rule_id) ⇒ Array?
Return array with key and value of the pair.
Methods included from Components::Logger::InstanceMethods
Class Method Details
.[](key) ⇒ Object Also known as: get
36 37 38 39 40 |
# File 'lib/contrast/agent/reporting/reporting_utilities/reporting_storage.rb', line 36 def [] key return unless key collection[key] end |
.[]=(key, value) ⇒ Object Also known as: set
Returns the value we saved.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/contrast/agent/reporting/reporting_utilities/reporting_storage.rb', line 23 def []= key, value return unless key return unless value logger.debug('Saving new value', key: key) key = key.to_s.downcase.strip collection[key] = value value # rubocop:disable Lint/Void end |
.collection ⇒ Object
So the collection will be used to store those events
16 17 18 |
# File 'lib/contrast/agent/reporting/reporting_utilities/reporting_storage.rb', line 16 def collection @_collection ||= {} end |
.delete(key) ⇒ Object
44 45 46 47 48 |
# File 'lib/contrast/agent/reporting/reporting_utilities/reporting_storage.rb', line 44 def delete key return unless key collection.delete(key) end |
.find_by_rule_id(rule_id) ⇒ Array?
Return array with key and value of the pair
52 53 54 55 56 |
# File 'lib/contrast/agent/reporting/reporting_utilities/reporting_storage.rb', line 52 def find_by_rule_id rule_id return unless rule_id collection.find { |_, v| v.rule_id == rule_id } end |