Class: TestProf::Autopilot::Merger

Inherits:
Object
  • Object
show all
Includes:
Dsl
Defined in:
lib/test_prof/autopilot/merger.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Dsl

#aggregate, #info, #run, #save

Constructor Details

#initialize(type, paths) ⇒ Merger

Returns a new instance of Merger.



26
27
28
29
30
# File 'lib/test_prof/autopilot/merger.rb', line 26

def initialize(type, paths)
  @type = type
  @paths = paths
  @report_class = Registry.fetch(:"#{type}_report")
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



24
25
26
# File 'lib/test_prof/autopilot/merger.rb', line 24

def paths
  @paths
end

#report_classObject (readonly)

Returns the value of attribute report_class.



24
25
26
# File 'lib/test_prof/autopilot/merger.rb', line 24

def report_class
  @report_class
end

#typeObject (readonly)

Returns the value of attribute type.



24
25
26
# File 'lib/test_prof/autopilot/merger.rb', line 24

def type
  @type
end

Class Method Details

.invoke(type, paths) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/test_prof/autopilot/merger.rb', line 15

def invoke(type, paths)
  paths = paths.flat_map(&Dir.method(:glob))

  Logging.log "Merging #{type} reports at #{paths.join(", ")}..."

  new(type, paths).print_report
end

Instance Method Details



32
33
34
35
36
37
38
39
# File 'lib/test_prof/autopilot/merger.rb', line 32

def print_report
  format = Autopilot.config.merge_format
  if format == "info"
    info agg_report
  else
    save agg_report, format: format, file_name: Autopilot.config.merge_file
  end
end