Class: Ruptr::TimingCache
- Inherits:
-
Object
- Object
- Ruptr::TimingCache
- Defined in:
- lib/ruptr/timing_cache.rb
Defined Under Namespace
Classes: Store
Constant Summary collapse
- TIMING_CACHE_FILENAME =
'timing'
Instance Attribute Summary collapse
-
#test_suite ⇒ Object
readonly
Returns the value of attribute test_suite.
Instance Method Summary collapse
-
#initialize(state_dir, test_suite) ⇒ TimingCache
constructor
A new instance of TimingCache.
- #save!(replace: true) ⇒ Object
- #timing_store ⇒ Object
Constructor Details
#initialize(state_dir, test_suite) ⇒ TimingCache
Returns a new instance of TimingCache.
12 13 14 15 |
# File 'lib/ruptr/timing_cache.rb', line 12 def initialize(state_dir, test_suite) @state_path = Pathname(state_dir) @test_suite = test_suite end |
Instance Attribute Details
#test_suite ⇒ Object (readonly)
Returns the value of attribute test_suite.
17 18 19 |
# File 'lib/ruptr/timing_cache.rb', line 17 def test_suite @test_suite end |
Instance Method Details
#save!(replace: true) ⇒ Object
30 31 32 33 |
# File 'lib/ruptr/timing_cache.rb', line 30 def save!(replace: true) return unless @timing_store @timing_store.dump(@test_suite, @cache_path, replace:) end |
#timing_store ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ruptr/timing_cache.rb', line 19 def timing_store @timing_store ||= begin @cache_path = @state_path / TIMING_CACHE_FILENAME if @cache_path.exist? TimingCache::Store.load(@test_suite, @cache_path) else TimingCache::Store.new end end end |