Module: TestProf::Utils::HTMLBuilder

Defined in:
lib/test_prof/utils/html_builder.rb

Overview

Generates static HTML reports with injected data

Class Method Summary collapse

Class Method Details

.generate(data:, template:, output:) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/test_prof/utils/html_builder.rb', line 10

def generate(data:, template:, output:)
  template = File.read(TestProf.asset_path(template))
  template.sub! "/**REPORT-DATA**/", data.to_json

  outpath = TestProf.artifact_path(output)
  File.write(outpath, template)
  outpath
end