Module: Instana::ThreadLocal

Included in:
Tracer
Defined in:
lib/instana/thread_local.rb

Instance Method Summary collapse

Instance Method Details

#thread_local(name) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/instana/thread_local.rb', line 3

def thread_local(name)
  key = "__#{self}_#{name}__".intern

  define_method(name) do
    Thread.current[key]
  end

  define_method(name.to_s + '=') do |value|
    Thread.current[key] = value
  end
end