Class: Makara::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/makara/context.rb

Class Method Summary collapse

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_currentObject



23
24
25
# File 'lib/makara/context.rb', line 23

def get_current
  get_current_thread_local_for(:makara_context_current)
end

.get_previousObject



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