class RSpec::Core::MemoizedHelpers::ThreadsafeMemoized
@private
Public Class Methods
# File rspec-core/lib/rspec/core/memoized_helpers.rb, line 171 def initialize @memoized = {} @mutex = Support::ReentrantMutex.new end
Public Instance Methods
# File rspec-core/lib/rspec/core/memoized_helpers.rb, line 176 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