Class: Rematch
- Inherits:
-
Object
- Object
- Rematch
- Defined in:
- lib/rematch.rb
Overview
Implement the key/value store
Constant Summary collapse
- VERSION =
'1.0'- EXT =
'.rematch'
Class Attribute Summary collapse
-
.refresh ⇒ Object
Returns the value of attribute refresh.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path:, id:) ⇒ Rematch
constructor
path and unique id of the test being run.
-
#rematch(value) ⇒ Object
store if unknown; retrieve otherwise.
Constructor Details
Class Attribute Details
.refresh ⇒ Object
Returns the value of attribute refresh.
13 14 15 |
# File 'lib/rematch.rb', line 13 def refresh @refresh end |
Class Method Details
.check_refresh(path) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/rematch.rb', line 15 def check_refresh(path) return unless @refresh && !@refreshed.include?(path) FileUtils.rm_f(path) @refreshed << path puts "Refresh #{path}" end |
Instance Method Details
#rematch(value) ⇒ Object
store if unknown; retrieve otherwise
33 34 35 36 |
# File 'lib/rematch.rb', line 33 def rematch(value) key = "[#{@count += 1}] #{@id}" @store.transaction { |s| s.root?(key) ? s[key] : s[key] = value } end |