123456789_123456789_123456789_123456789_123456789_

Module: SimpleCov::LastRun

Relationships & Source Files
Defined in: lib/simplecov/last_run.rb

Class Method Summary

Class Method Details

.last_run_path

[ GitHub ]

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

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

.read

[ GitHub ]

  
# File 'lib/simplecov/last_run.rb', line 12

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, symbolize_names: true)
end

.write(json)

[ GitHub ]

  
# File 'lib/simplecov/last_run.rb', line 21

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