Class: Varar::Runner::FileBaselineStore

Inherits:
Object
  • Object
show all
Defined in:
lib/varar/runner/baseline_store.rb

Overview

The filesystem BaselineStore: the committed drift baseline lives at the project root as varar.lock.json. The core owns the format; this adapter only moves raw text. Port of baseline_store.py.

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ FileBaselineStore

Returns a new instance of FileBaselineStore.



9
10
11
# File 'lib/varar/runner/baseline_store.rb', line 9

def initialize(root)
  @path = File.join(root.to_s, 'varar.lock.json')
end

Instance Method Details

#readObject



13
14
15
# File 'lib/varar/runner/baseline_store.rb', line 13

def read
  File.exist?(@path) ? File.read(@path, encoding: 'UTF-8') : nil
end

#write(contents) ⇒ Object



17
18
19
# File 'lib/varar/runner/baseline_store.rb', line 17

def write(contents)
  File.write(@path, contents)
end