Sha256: 7489d6eb0ef560333ed0493e01a63c46255fe1787d9b67dca28318a8aa7d9c84

Contents?: true

Size: 536 Bytes

Versions: 23

Compression:

Stored size: 536 Bytes

Contents

# Copyright (c) 2016 SolarWinds, LLC.
# All rights reserved.

module AppOpticsAPM
  ##
  # Provides thread local storage for AppOpticsAPM.
  #
  # Example usage:
  # module AppOpticsAPMBase
  #   extend AppOpticsAPM::ThreadLocal
  #   thread_local :layer_op
  # end
  module ThreadLocal
    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
  end
end

Version data entries

23 entries across 23 versions & 3 rubygems

Version Path
appoptics_apm-zearn-4.13.1 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.13.0 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.12.2 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.12.1 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.12.0 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.11.2 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.11.1 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.11.0 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.10.1 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.10.0 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.9.0 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.8.4 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.8.3 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.8.2 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.8.1 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.8.0 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.7.0 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.6.0 lib/appoptics_apm/thread_local.rb
appoptics_apm_mnfst-4.5.2 lib/appoptics_apm/thread_local.rb
appoptics_apm-4.5.2 lib/appoptics_apm/thread_local.rb