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

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/memoized_helpers.rb

Instance Method Summary collapse

Constructor Details

#initializeNonThreadSafeMemoized

Returns a new instance of NonThreadSafeMemoized.



187
188
189
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/memoized_helpers.rb', line 187

def initialize
  @memoized = {}
end

Instance Method Details

#fetch_or_store(key) ⇒ Object



191
192
193
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/memoized_helpers.rb', line 191

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