Class: SimcovAiFormatter::ResultsetLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/simcov_ai_formatter/resultset_loader.rb

Overview

Loads SimpleCov’s .resultset.json, validates its shape, and returns the parsed Hash.

Expected shape:

{
  "<suite_name>" => {
    "coverage" => { "<abs_path>" => { "lines" => [...], "branches" => {...} } },
    "timestamp" => Integer
  },
  ...
}

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ResultsetLoader

Returns a new instance of ResultsetLoader.



15
16
17
# File 'lib/simcov_ai_formatter/resultset_loader.rb', line 15

def initialize(path)
  @path = path
end

Instance Method Details

#loadObject



19
20
21
22
23
# File 'lib/simcov_ai_formatter/resultset_loader.rb', line 19

def load
  raw = read_json
  validate!(raw)
  raw
end