Class: Stoplight::Domain::ErrorTrackingPolicy
- Inherits:
-
Object
- Object
- Stoplight::Domain::ErrorTrackingPolicy
- Defined in:
- lib/stoplight/domain/error_tracking_policy.rb,
sig/_private/stoplight/domain/error_tracking_policy.rbs
Overview
Determines which errors should be traced
Instance Method Summary collapse
-
#initialize(tracked:, skipped:) ⇒ ErrorTrackingPolicy
constructor
A new instance of ErrorTrackingPolicy.
- #skipped?(error) ⇒ Boolean
- #track?(error) ⇒ Boolean
- #tracked?(error) ⇒ Boolean
Constructor Details
#initialize(tracked:, skipped:) ⇒ ErrorTrackingPolicy
Returns a new instance of ErrorTrackingPolicy.
7 8 9 10 |
# File 'lib/stoplight/domain/error_tracking_policy.rb', line 7 def initialize(tracked:, skipped:) @tracked = tracked @skipped = skipped end |
Instance Method Details
#skipped?(error) ⇒ Boolean
18 19 20 |
# File 'lib/stoplight/domain/error_tracking_policy.rb', line 18 def skipped?(error) @skipped.any? { |matcher| matcher === error } end |
#track?(error) ⇒ Boolean
12 13 14 |
# File 'lib/stoplight/domain/error_tracking_policy.rb', line 12 def track?(error) !skipped?(error) && tracked?(error) end |
#tracked?(error) ⇒ Boolean
22 23 24 |
# File 'lib/stoplight/domain/error_tracking_policy.rb', line 22 def tracked?(error) @tracked.any? { |matcher| matcher === error } end |