Sha256: 0902fb7bc5769c01ec9ee3d40cbf3caa959b613dfd12a48497e5411f32472264

Contents?: true

Size: 672 Bytes

Versions: 7

Compression:

Stored size: 672 Bytes

Contents

# frozen_string_literal: true

class OpenTracingTestTracer
  class ScopeManager
    # @api private
    class ScopeStack
      def initialize
        # Generate a random identifier to use as the Thread.current key. This is
        # needed so that it would be possible to create multiple tracers in one
        # thread (mostly useful for testing purposes)
        @scope_identifier = ScopeIdentifier.generate
      end

      def push(scope)
        store << scope
      end

      def pop
        store.pop
      end

      def peek
        store.last
      end

      private

      def store
        Thread.current[@scope_identifier] ||= []
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
signalfx_test_tracer-0.1.4 lib/signalfx_test_tracer/scope_manager/scope_stack.rb
signalfx_test_tracer-0.1.3 lib/signalfx_test_tracer/scope_manager/scope_stack.rb
signalfx_test_tracer-0.1.2 lib/signalfx_test_tracer/scope_manager/scope_stack.rb
signalfx_test_tracer-0.1.1 lib/signalfx_test_tracer/scope_manager/scope_stack.rb
signalfx_test_tracer-0.1.0 lib/signalfx_test_tracer/scope_manager/scope_stack.rb
opentracing_test_tracer-0.1.1 lib/opentracing_test_tracer/scope_manager/scope_stack.rb
opentracing_test_tracer-0.1.0 lib/opentracing_test_tracer/scope_manager/scope_stack.rb