Class: Shift::Api::Core::RequestId
- Inherits:
-
Object
- Object
- Shift::Api::Core::RequestId
- Defined in:
- lib/shift/api/core/request_id.rb
Overview
A utility class to generate request id numbers for logging purposes
Class Method Summary collapse
-
.call ⇒ Integer
Generates the next request id.
-
.reset ⇒ Object
Resets the request id back to zero.
Class Method Details
.call ⇒ Integer
Generates the next request id
8 9 10 11 12 |
# File 'lib/shift/api/core/request_id.rb', line 8 def self.call thread_vars = Shift::Api::Core.root_thread_vars thread_vars[:request_id] ||= 0 thread_vars[:request_id] += 1 end |
.reset ⇒ Object
Resets the request id back to zero
15 16 17 |
# File 'lib/shift/api/core/request_id.rb', line 15 def self.reset Shift::Api::Core.root_thread_vars[:request_id] = 0 end |