class RSpec::Core::MemoizedHelpers::ThreadsafeMemoized

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/rspec/core/memoized_helpers.rbs

class RSpec::Core::MemoizedHelpers::ThreadsafeMemoized
  def fetch_or_store: (Symbol key) -> untyped
  def initialize: () -> void
end

@private

def fetch_or_store(key)

Experimental RBS support (using type sampling data from the type_fusion project).

def fetch_or_store: (Symbol key) -> untyped

This signature was generated using 5 samples from 1 application.

def fetch_or_store(key)
  @memoized.fetch(key) do # only first access pays for synchronization
    @mutex.synchronize do
      @memoized.fetch(key) { @memoized[key] = yield }
    end
  end
end

def initialize

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: () -> void

This signature was generated using 5 samples from 1 application.

def initialize
  @memoized = {}
  @mutex = Support::ReentrantMutex.new
end