16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/class_metrix/formatters/markdown_formatter.rb', line 16
def format
return "" if @data[:headers].empty? || @data[:rows].empty?
output = []
if @options.fetch(:show_metadata, true)
= Formatters::Components::.new(@data, @options.merge(format: :markdown))
= .generate
output.concat() unless .empty?
end
table_data = @expand_hashes ? @table_builder.build_expanded_table : @table_builder.build_simple_table
table_output = render_markdown_table(table_data)
unless table_output.empty?
output << table_output.join("\n")
end
if @options.fetch(:show_missing_summary, false)
missing_component = Formatters::Components::MissingBehaviorsComponent.new(@data, @options)
missing_output = missing_component.generate
output.concat(missing_output) unless missing_output.empty?
end
if @options.fetch(:show_footer, true)
= Formatters::Components::.new(@options)
= .generate
output.concat() unless .empty?
end
output.reject { |section| section.nil? || section == "" }.join("\n\n")
end
|