Class: DeepCover::Reporter::HTML::Index

Inherits:
Struct
  • Object
show all
Extended by:
Forwardable
Includes:
Base
Defined in:
lib/deep_cover/reporter/html/index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Base

#setup

Methods included from Tools::ContentTag

#content_tag

Instance Attribute Details

#baseObject

Returns the value of attribute base

Returns:

  • (Object)

    the current value of base



7
8
9
# File 'lib/deep_cover/reporter/html/index.rb', line 7

def base
  @base
end

Instance Method Details

#columnsObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/deep_cover/reporter/html/index.rb', line 31

def columns
  _covered_code, analyser_map = analysis.analyser_map.first
  analyser_map ||= []
  columns = analyser_map.flat_map do |type, analyser|
    [{
       value: type,
       header: analyser.class.human_name,
     }, {
          value: :"#{type}_percent",
          header: '%',
        },
    ]
  end
  columns.unshift(width: 400, header: 'Path')
  columns
end

#stats_to_dataObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/deep_cover/reporter/html/index.rb', line 12

def stats_to_data
  populate_stats do |full_path, partial_path, data, children|
    data = transform_data(data)
    if children.empty?
      {
        text: %{<a href="#{full_path}.html">#{partial_path}</a>},
        data: data,
      }
    else
      {
        text: partial_path,
        data: data,
        children: children,
        state: {opened: true},
      }
    end
  end
end