Module: Polytrix::Command::Generate::Dashboard::Helpers
Instance Method Summary
collapse
included
#ansi2html, #escape_html, #highlight, #slugify
Instance Method Details
#as_json(table) ⇒ Object
41
42
43
|
# File 'lib/polytrix/command/generators/dashboard.rb', line 41
def as_json(table)
JSON.dump(table)
end
|
#bootstrap_color(color) ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/polytrix/command/generators/dashboard.rb', line 49
def bootstrap_color(color)
bootstrap_classes = {
green: 'success',
cyan: 'primary',
red: 'danger',
yellow: 'warning'
}
bootstrap_classes.key?(color) ? bootstrap_classes[color] : color
end
|
#implementors ⇒ Object
16
17
18
19
20
|
# File 'lib/polytrix/command/generators/dashboard.rb', line 16
def implementors
Polytrix.implementors.map do |implementor|
slugify(implementor.name)
end
end
|
#results ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/polytrix/command/generators/dashboard.rb', line 22
def results
manifest = Polytrix.manifest
rows = []
grouped_challenges = manifest.challenges.values.group_by { |challenge| [challenge.suite, challenge.name] }
grouped_challenges.each do |(suite, name), challenges|
row = {
slug_prefix: slugify(suite, name),
suite: suite,
scenario: name
}
Polytrix.implementors.each do |implementor|
challenge = challenges.find { |c| c.implementor == implementor }
row[slugify(implementor.name)] = challenge.status_description
end
rows << row
end
rows
end
|
#status(status, msg = nil, _color = :cyan) ⇒ Object
45
46
47
|
# File 'lib/polytrix/command/generators/dashboard.rb', line 45
def status(status, msg = nil, _color = :cyan)
"<strong>#{status}</strong> <em>#{msg}</em>"
end
|