Sha256: f0815a5da75d7f3c6f5936b0804568ccc15b01cb96f0371a4a40d9ff432a16f9

Contents?: true

Size: 498 Bytes

Versions: 27

Compression:

Stored size: 498 Bytes

Contents

# frozen_string_literal: true

module Checkoff
  module Internal
    # Manage thread lock variables in a block
    class ThreadLocal
      # @sg-ignore
      # @param name [Symbol]
      # @param value [Object,Boolean]
      #
      # @return [Object,Boolean]
      def with_thread_local_variable(name, value, &block)
        old_value = Thread.current[name]
        Thread.current[name] = value
        block.yield
      ensure
        Thread.current[name] = old_value
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
checkoff-0.201.0 lib/checkoff/internal/thread_local.rb
checkoff-0.200.0 lib/checkoff/internal/thread_local.rb
checkoff-0.199.0 lib/checkoff/internal/thread_local.rb
checkoff-0.198.0 lib/checkoff/internal/thread_local.rb
checkoff-0.197.0 lib/checkoff/internal/thread_local.rb
checkoff-0.196.0 lib/checkoff/internal/thread_local.rb
checkoff-0.195.0 lib/checkoff/internal/thread_local.rb
checkoff-0.194.0 lib/checkoff/internal/thread_local.rb
checkoff-0.193.0 lib/checkoff/internal/thread_local.rb
checkoff-0.192.0 lib/checkoff/internal/thread_local.rb
checkoff-0.191.0 lib/checkoff/internal/thread_local.rb
checkoff-0.190.0 lib/checkoff/internal/thread_local.rb
checkoff-0.189.0 lib/checkoff/internal/thread_local.rb
checkoff-0.188.0 lib/checkoff/internal/thread_local.rb
checkoff-0.187.0 lib/checkoff/internal/thread_local.rb
checkoff-0.186.0 lib/checkoff/internal/thread_local.rb
checkoff-0.185.0 lib/checkoff/internal/thread_local.rb
checkoff-0.184.0 lib/checkoff/internal/thread_local.rb
checkoff-0.183.0 lib/checkoff/internal/thread_local.rb
checkoff-0.182.0 lib/checkoff/internal/thread_local.rb