Class: Graphiti::Audit::Report
Defined Under Namespace
Classes: Cell
Constant Summary collapse
- ANSI =
{red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, bold: 1, dim: 2}.freeze
- ISSUE_HEADINGS =
{ broken_relationship: "raised while being inspected", missing_association_method: "will raise when the relationship is included: the model has no association method", missing_guard_method: "will raise whenever the resource renders: the readable guard is not defined", missing_sideload_filter: "will raise when the relationship is included: the related resource is missing the filter", link_hidden: "renders no related link: it would expose a primary key the related resource hides" }.freeze
- CHECKLIST =
{ broken_relationship: ["all relationships inspectable", "relationship", "raised while being inspected"], missing_association_method: ["all association methods defined", "association method", "missing"], missing_guard_method: ["all readable guards defined", "readable guard", "missing"], missing_sideload_filter: ["all sideload filters declared", "sideload filter", "missing"], link_hidden: ["all relationship links renderable", "relationship link", "hidden"], loads_on_every_render: ["all id-rendering loads preloaded", "relationship", "loading ids without preloading"] }.freeze
Instance Method Summary collapse
-
#initialize(rows, color: $stdout.tty?) ⇒ Report
constructor
A new instance of Report.
- #to_s ⇒ Object
Constructor Details
#initialize(rows, color: $stdout.tty?) ⇒ Report
Returns a new instance of Report.
29 30 31 32 |
# File 'lib/graphiti/audit/report.rb', line 29 def initialize(rows, color: $stdout.tty?) @rows = rows @color = color end |
Instance Method Details
#to_s ⇒ Object
34 35 36 37 38 |
# File 'lib/graphiti/audit/report.rb', line 34 def to_s return "graphiti: no relationships found.\n" if @rows.empty? (body + [summary]).join("\n") end |