Module: Oboe::ThreadLocal

Included in:
OboeBase
Defined in:
lib/oboe-heroku/thread_local.rb

Instance Method Summary collapse

Instance Method Details

#thread_local(name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/oboe-heroku/thread_local.rb', line 6

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