Class: Makara::Context
- Inherits:
-
Object
- Object
- Makara::Context
- Defined in:
- lib/makara/context.rb
Class Method Summary collapse
- .generate(seed = nil) ⇒ Object
- .get_current ⇒ Object
- .get_previous ⇒ Object
- .set_current(context) ⇒ Object
- .set_previous(context) ⇒ Object
Class Method Details
.generate(seed = nil) ⇒ Object
10 11 12 13 |
# File 'lib/makara/context.rb', line 10 def generate(seed = nil) seed ||= "#{Time.now.to_i}#{Thread.current.object_id}#{rand(99999)}" Digest::MD5.hexdigest(seed) end |
.get_current ⇒ Object
23 24 25 |
# File 'lib/makara/context.rb', line 23 def get_current get_current_thread_local_for(:makara_context_current) end |
.get_previous ⇒ Object
15 16 17 |
# File 'lib/makara/context.rb', line 15 def get_previous get_current_thread_local_for(:makara_context_previous) end |
.set_current(context) ⇒ Object
27 28 29 |
# File 'lib/makara/context.rb', line 27 def set_current(context) set_current_thread_local(:makara_context_current,context) end |
.set_previous(context) ⇒ Object
19 20 21 |
# File 'lib/makara/context.rb', line 19 def set_previous(context) set_current_thread_local(:makara_context_previous,context) end |