Module: XRay::ThreadAwareDispatcher
- Defined in:
- lib/xray/thread_aware_dispatcher.rb
Class Method Summary collapse
-
.included(target) ⇒ Object
Intercept dispatch with our own method when the module is included.
Class Method Details
.included(target) ⇒ Object
Intercept dispatch with our own method when the module is included.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/xray/thread_aware_dispatcher.rb', line 6 def self.included(target) class << target attr_reader :thread_in_dispatch alias actual_dispatch dispatch # Capture as an instance variable the current # thread -- which is processing current Rails request -- # and do the actual dispatch. def dispatch(*args) @thread_in_dispatch = Thread.current actual_dispatch *args ensure @thread_in_dispatch = nil end end end |