Class: Oselvar::Var::Runner::FileBaselineStore

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

Overview

The filesystem BaselineStore: the committed drift baseline lives at the project root as var.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.



10
11
12
# File 'lib/oselvar/var/runner/baseline_store.rb', line 10

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

Instance Method Details

#readObject



14
15
16
# File 'lib/oselvar/var/runner/baseline_store.rb', line 14

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

#write(contents) ⇒ Object



18
19
20
# File 'lib/oselvar/var/runner/baseline_store.rb', line 18

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