Class: Datadog::Contrib::ActiveSupport::Notifications::Subscription::Handler
- Inherits:
-
Object
- Object
- Datadog::Contrib::ActiveSupport::Notifications::Subscription::Handler
- Defined in:
- lib/ddtrace/contrib/active_support/notifications/subscription.rb
Overview
Wrapper for subscription handler
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
-
#initialize(&block) ⇒ Handler
constructor
A new instance of Handler.
- #run(span, name, id, payload) ⇒ Object
- #run!(*args) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Handler
Returns a new instance of Handler.
115 116 117 |
# File 'lib/ddtrace/contrib/active_support/notifications/subscription.rb', line 115 def initialize(&block) @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
113 114 115 |
# File 'lib/ddtrace/contrib/active_support/notifications/subscription.rb', line 113 def block @block end |
Instance Method Details
#run(span, name, id, payload) ⇒ Object
119 120 121 122 123 |
# File 'lib/ddtrace/contrib/active_support/notifications/subscription.rb', line 119 def run(span, name, id, payload) run!(span, name, id, payload) rescue StandardError => e Datadog.logger.debug("ActiveSupport::Notifications handler for '#{name}' failed: #{e.}") end |
#run!(*args) ⇒ Object
125 126 127 |
# File 'lib/ddtrace/contrib/active_support/notifications/subscription.rb', line 125 def run!(*args) @block.call(*args) end |