module TraceView::ThreadLocal

Provides thread local storage for TraceView.

Example usage: module TraceViewBase

extend ::TraceView::ThreadLocal
thread_local :layer_op

end

Public Instance Methods

thread_local(name) click to toggle source
# File lib/traceview/thread_local.rb, line 14
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