Class: TestProf::AnyFixture::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/test_prof/any_fixture.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



13
14
15
# File 'lib/test_prof/any_fixture.rb', line 13

def initialize
  @store = {}
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



9
10
11
# File 'lib/test_prof/any_fixture.rb', line 9

def store
  @store
end

Instance Method Details

#fetch(key) ⇒ Object



17
18
19
20
21
# File 'lib/test_prof/any_fixture.rb', line 17

def fetch(key)
  return store[key] if store.key?(key)
  return unless block_given?
  store[key] = yield
end