Class: TestProf::Autopilot::FactoryDefault::Report

Inherits:
Object
  • Object
show all
Extended by:
ReportBuilder
Defined in:
lib/test_prof/autopilot/factory_default/report.rb

Constant Summary collapse

ARTIFACT_FILE =
"factory_default_prof_report.json"

Constants included from ReportBuilder

ReportBuilder::ARTIFACT_MISSING_HINT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ReportBuilder

build

Constructor Details

#initialize(raw_report) ⇒ Report

Returns a new instance of Report.



18
19
20
21
# File 'lib/test_prof/autopilot/factory_default/report.rb', line 18

def initialize(raw_report)
  @type = :factory_default_prof
  @raw_report = raw_report
end

Instance Attribute Details

#raw_reportObject (readonly)

Returns the value of attribute raw_report.



16
17
18
# File 'lib/test_prof/autopilot/factory_default/report.rb', line 16

def raw_report
  @raw_report
end

#typeObject (readonly)

Returns the value of attribute type.



16
17
18
# File 'lib/test_prof/autopilot/factory_default/report.rb', line 16

def type
  @type
end

Instance Method Details

#factoriesObject



27
28
29
# File 'lib/test_prof/autopilot/factory_default/report.rb', line 27

def factories
  result.dup
end

#merge(other) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/test_prof/autopilot/factory_default/report.rb', line 31

def merge(other)
  report = result.dup

  other.result.each do |name, stats|
    if result.key?(name)
      report[name][:count] += stats[:count]
      report[name][:time] += stats[:time]
    else
      report[name] = stats
    end
  end

  Report.new(report)
end

#resultObject



23
24
25
# File 'lib/test_prof/autopilot/factory_default/report.rb', line 23

def result
  @result ||= raw_report.tap { |r| r.transform_values! { |v| v.transform_keys!(&:to_sym) } }
end