Class: Xcprofiler::JSONReporter

Inherits:
AbstractReporter show all
Defined in:
lib/xcprofiler/reporters/json_reporter.rb

Constant Summary

Constants inherited from AbstractReporter

AbstractReporter::DEFAULT_TRUNCATE_AT

Instance Attribute Summary

Attributes inherited from AbstractReporter

#options

Instance Method Summary collapse

Methods inherited from AbstractReporter

#filter_executions, #initialize

Constructor Details

This class inherits a constructor from Xcprofiler::AbstractReporter

Instance Method Details

#report!(executions) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/xcprofiler/reporters/json_reporter.rb', line 5

def report!(executions)
  json = executions.map(&:to_h)
  unless output_path
    raise OutputPathIsNotSpecified, '[JSONReporter] output_path is not specified'
  end

  File.open(output_path, "w") do |f|
    f.write(JSON.pretty_generate(json))
  end
end