Class: TestProf::Autopilot::FactoryProf::Report
- Inherits:
-
Object
- Object
- TestProf::Autopilot::FactoryProf::Report
- Extended by:
- ReportBuilder
- Defined in:
- lib/test_prof/autopilot/factory_prof/report.rb
Overview
:factory_prof report allows to add additional functionality for it’s instances
Constant Summary collapse
- ARTIFACT_FILE =
"factory_prof_report.json"
Constants included from ReportBuilder
ReportBuilder::ARTIFACT_MISSING_HINT
Instance Attribute Summary collapse
-
#raw_report ⇒ Object
readonly
Returns the value of attribute raw_report.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(raw_report) ⇒ Report
constructor
A new instance of Report.
- #merge(other) ⇒ Object
- #result ⇒ Object
Methods included from ReportBuilder
Constructor Details
#initialize(raw_report) ⇒ Report
Returns a new instance of Report.
20 21 22 23 |
# File 'lib/test_prof/autopilot/factory_prof/report.rb', line 20 def initialize(raw_report) @type = :factory_prof @raw_report = raw_report end |
Instance Attribute Details
#raw_report ⇒ Object (readonly)
Returns the value of attribute raw_report.
18 19 20 |
# File 'lib/test_prof/autopilot/factory_prof/report.rb', line 18 def raw_report @raw_report end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
18 19 20 |
# File 'lib/test_prof/autopilot/factory_prof/report.rb', line 18 def type @type end |
Instance Method Details
#merge(other) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/test_prof/autopilot/factory_prof/report.rb', line 32 def merge(other) report = raw_report.dup report["stacks"] += other.raw_report["stacks"] if report["stacks"] (report["raw_stats"].values + other.raw_report["raw_stats"].values).each_with_object({}) do |data, acc| if acc.key?(data["name"]) current = acc[data["name"]] current["total_count"] += data["total_count"] current["top_level_count"] += data["top_level_count"] current["total_time"] += data["total_time"] current["top_level_time"] += data["top_level_time"] else acc[data["name"]] = data.dup end end.then do |stats| report["raw_stats"] = stats end Report.new(report) end |
#result ⇒ Object
25 26 27 28 29 30 |
# File 'lib/test_prof/autopilot/factory_prof/report.rb', line 25 def result @result ||= TestProf::FactoryProf::Result.new( raw_report["stacks"], raw_report["raw_stats"].transform_values! { |stats| stats.transform_keys!(&:to_sym) } ) end |