Module: SimpleCov::LastRun

Defined in:
lib/simplecov/last_run.rb

Class Method Summary collapse

Class Method Details

.last_run_pathObject



6
7
8
# File 'lib/simplecov/last_run.rb', line 6

def last_run_path
  File.join(SimpleCov.coverage_path, ".last_run.json")
end

.readObject



10
11
12
13
14
15
# File 'lib/simplecov/last_run.rb', line 10

def read
  return nil unless File.exist?(last_run_path)
  json = File.read(last_run_path)
  return nil if json.strip.empty?
  JSON.parse(json)
end

.write(json) ⇒ Object



17
18
19
20
21
# File 'lib/simplecov/last_run.rb', line 17

def write(json)
  File.open(last_run_path, "w+") do |f|
    f.puts JSON.pretty_generate(json)
  end
end