Class: TestProf::AnyFixture::Cache
- Inherits:
-
Object
- Object
- TestProf::AnyFixture::Cache
- Defined in:
- lib/test_prof/any_fixture.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Instance Method Summary collapse
- #fetch(key) ⇒ Object
-
#initialize ⇒ Cache
constructor
A new instance of Cache.
Constructor Details
#initialize ⇒ Cache
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
#store ⇒ Object (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 |