Class: ActiveSupport::Notifications::Instrumenter
- Inherits:
-
Object
- Object
- ActiveSupport::Notifications::Instrumenter
- Defined in:
- lib/forgery_protection/instrumenter_extension.rb
Instance Method Summary collapse
Instance Method Details
#instrument(name, payload = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/forgery_protection/instrumenter_extension.rb', line 2 def instrument(name, payload={}) started = Time.now begin yield.tap { |result| payload[:result] = result } rescue Exception => e payload[:exception] = [e.class.name, e.] raise e ensure @notifier.publish(name, started, Time.now, @id, payload) end end |