Class: Oselvar::Var::Runner::FileBaselineStore
- Inherits:
-
Object
- Object
- Oselvar::Var::Runner::FileBaselineStore
- 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
-
#initialize(root) ⇒ FileBaselineStore
constructor
A new instance of FileBaselineStore.
- #read ⇒ Object
- #write(contents) ⇒ Object
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
#read ⇒ Object
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 |