Class: Bugsnag::Breadcrumbs::Validator
- Inherits:
-
Object
- Object
- Bugsnag::Breadcrumbs::Validator
- Defined in:
- lib/bugsnag/breadcrumbs/validator.rb
Overview
Validates a given breadcrumb before it is stored
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Validator
constructor
A new instance of Validator.
-
#validate(breadcrumb) ⇒ Object
Validates a given breadcrumb.
Constructor Details
#initialize(configuration) ⇒ Validator
Returns a new instance of Validator.
7 8 9 |
# File 'lib/bugsnag/breadcrumbs/validator.rb', line 7 def initialize(configuration) @configuration = configuration end |
Instance Method Details
#validate(breadcrumb) ⇒ Object
Validates a given breadcrumb.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bugsnag/breadcrumbs/validator.rb', line 15 def validate() # Check type is valid, set to manual otherwise unless Bugsnag::Breadcrumbs::VALID_BREADCRUMB_TYPES.include?(.type) @configuration.debug("Invalid type: #{.type} for breadcrumb: #{.name}, defaulting to #{Bugsnag::Breadcrumbs::MANUAL_BREADCRUMB_TYPE}") .type = Bugsnag::Breadcrumbs::MANUAL_BREADCRUMB_TYPE end # If auto is true, check type is in enabled_automatic_breadcrumb_types return unless .auto && !@configuration..include?(.type) @configuration.debug("Automatic breadcrumb of type #{.type} ignored: #{.name}") .ignore! end |