Class: Bugsnag::Breadcrumbs::OnBreadcrumbCallbackList
- Inherits:
-
Object
- Object
- Bugsnag::Breadcrumbs::OnBreadcrumbCallbackList
- Defined in:
- lib/bugsnag/breadcrumbs/on_breadcrumb_callback_list.rb
Instance Method Summary collapse
- #add(callback) ⇒ void
- #call(breadcrumb) ⇒ void
-
#initialize(configuration) ⇒ OnBreadcrumbCallbackList
constructor
A new instance of OnBreadcrumbCallbackList.
- #remove(callback) ⇒ void
Constructor Details
#initialize(configuration) ⇒ OnBreadcrumbCallbackList
Returns a new instance of OnBreadcrumbCallbackList.
3 4 5 6 7 |
# File 'lib/bugsnag/breadcrumbs/on_breadcrumb_callback_list.rb', line 3 def initialize(configuration) @callbacks = Set.new @mutex = Mutex.new @configuration = configuration end |
Instance Method Details
#add(callback) ⇒ void
This method returns an undefined value.
12 13 14 15 16 |
# File 'lib/bugsnag/breadcrumbs/on_breadcrumb_callback_list.rb', line 12 def add(callback) @mutex.synchronize do @callbacks.add(callback) end end |
#call(breadcrumb) ⇒ void
This method returns an undefined value.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/bugsnag/breadcrumbs/on_breadcrumb_callback_list.rb', line 30 def call() @callbacks.each do |callback| begin should_continue = callback.call() rescue StandardError => e @configuration.warn("Error occurred in on_breadcrumb callback: '#{e}'") @configuration.warn("on_breadcrumb callback stacktrace: #{e.backtrace.inspect}") end # only stop if should_continue is explicity 'false' to allow callbacks # to return 'nil' if should_continue == false .ignore! break end end end |
#remove(callback) ⇒ void
This method returns an undefined value.
21 22 23 24 25 |
# File 'lib/bugsnag/breadcrumbs/on_breadcrumb_callback_list.rb', line 21 def remove(callback) @mutex.synchronize do @callbacks.delete(callback) end end |