Class: Contrast::Agent::Reporting::LibraryUsageObservation
- Inherits:
-
ReportableHash
- Object
- ReportableHash
- Contrast::Agent::Reporting::LibraryUsageObservation
- Defined in:
- lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb
Overview
The usage, meaning loaded files, of a library seen during this request
Instance Attribute Summary collapse
- #id ⇒ Object readonly
- #names ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(id, class_names) ⇒ LibraryUsageObservation
constructor
A new instance of LibraryUsageObservation.
- #to_controlled_hash ⇒ Object
- #validate ⇒ Object
Methods inherited from ReportableHash
Methods included from Components::Logger::InstanceMethods
Constructor Details
#initialize(id, class_names) ⇒ LibraryUsageObservation
Returns a new instance of LibraryUsageObservation.
19 20 21 22 23 |
# File 'lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb', line 19 def initialize id, class_names @id = id @names = class_names super() end |
Instance Attribute Details
#id ⇒ Object (readonly)
13 14 15 |
# File 'lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb', line 13 def id @id end |
#names ⇒ Object (readonly)
15 16 17 |
# File 'lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb', line 15 def names @names end |
Instance Method Details
#to_controlled_hash ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb', line 26 def to_controlled_hash validate { id: @id, names: @names } end |
#validate ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb', line 35 def validate if Contrast::Utils::DuckUtils.empty_duck?(id) raise(ArgumentError, "#{ self } did not have a proper id. Unable to continue.") end if Contrast::Utils::DuckUtils.empty_duck?(names) raise(ArgumentError, "#{ self } did not have a proper names. Unable to continue.") end nil end |