Class: Bugsnag::Middleware::Callbacks

Inherits:
Object
  • Object
show all
Defined in:
lib/bugsnag/middleware/callbacks.rb

Instance Method Summary collapse

Constructor Details

#initialize(bugsnag) ⇒ Callbacks

Returns a new instance of Callbacks.



3
4
5
# File 'lib/bugsnag/middleware/callbacks.rb', line 3

def initialize(bugsnag)
  @bugsnag = bugsnag
end

Instance Method Details

#call(notification) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/bugsnag/middleware/callbacks.rb', line 7

def call(notification)
  if notification.request_data[:before_callbacks]
    notification.request_data[:before_callbacks].each {|c| c.call(*[notification][0...c.arity]) }
  end

  @bugsnag.call(notification)

  if notification.request_data[:after_callbacks]
    notification.request_data[:after_callbacks].each {|c| c.call(*[notification][0...c.arity]) }
  end
end