Class: Contrast::Agent::Reporting::ObservedLibraryUsage
- Inherits:
-
ApplicationReportingEvent
- Object
- ReportableHash
- ReportingEvent
- ApplicationReportingEvent
- Contrast::Agent::Reporting::ObservedLibraryUsage
- Defined in:
- lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb
Overview
List of libraries that have been observed to have something loaded or executed.
Instance Attribute Summary collapse
-
#observations ⇒ Object
readonly
Returns the value of attribute observations.
Attributes inherited from ReportingEvent
#event_endpoint, #event_method
Instance Method Summary collapse
- #file_name ⇒ Object
-
#initialize ⇒ ObservedLibraryUsage
constructor
A new instance of ObservedLibraryUsage.
- #to_controlled_hash ⇒ Object
- #validate ⇒ Object
Methods inherited from ReportingEvent
Methods inherited from ReportableHash
Methods included from Components::Logger::InstanceMethods
Constructor Details
#initialize ⇒ ObservedLibraryUsage
Returns a new instance of ObservedLibraryUsage.
16 17 18 19 20 |
# File 'lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb', line 16 def initialize @event_endpoint = Contrast::Agent::Reporting::Endpoints.library_usage @observations = [] super() end |
Instance Attribute Details
#observations ⇒ Object (readonly)
Returns the value of attribute observations.
14 15 16 |
# File 'lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb', line 14 def observations @observations end |
Instance Method Details
#file_name ⇒ Object
22 23 24 |
# File 'lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb', line 22 def file_name 'library-observation' end |
#to_controlled_hash ⇒ Object
26 27 28 29 |
# File 'lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb', line 26 def to_controlled_hash validate { observations: @observations.map(&:to_controlled_hash) } end |
#validate ⇒ Object
31 32 33 34 35 |
# File 'lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb', line 31 def validate raise(ArgumentError, "#{ self } did not have observations. Unable to continue.") if observations.empty? nil end |