Class: RSpec::Core::MemoizedHelpers::NonThreadSafeMemoized

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/core/memoized_helpers.rb

Instance Method Summary collapse

Constructor Details

#initializeNonThreadSafeMemoized



165
166
167
# File 'lib/rspec/core/memoized_helpers.rb', line 165

def initialize
  @memoized = {}
end

Instance Method Details

#fetch_or_store(key) ⇒ Object



169
170
171
# File 'lib/rspec/core/memoized_helpers.rb', line 169

def fetch_or_store(key)
  @memoized.fetch(key) { @memoized[key] = yield }
end