class DeepCover::Reporter::HTML::Index
Public Instance Methods
columns()
click to toggle source
# 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_data()
click to toggle source
# 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
Private Instance Methods
transform_data(data)
click to toggle source
{per_char: Stat, …} => {per_char: {ignored: …}, per_char_percent: 55.55, …}
# File lib/deep_cover/reporter/html/index.rb, line 51 def transform_data(data) numbers = data.transform_values(&:to_h) percent = data.to_h { |type, stat| [:"#{type}_percent", stat.percent_covered] } numbers.merge(percent) end