Class: Cane::ViolationFormatter
- Inherits:
-
Struct
- Object
- Struct
- Cane::ViolationFormatter
- Defined in:
- lib/cane/violation_formatter.rb
Overview
Computes a string to be displayed as output from an array of violations computed by the checks.
Instance Attribute Summary collapse
-
#violations ⇒ Object
Returns the value of attribute violations.
Instance Method Summary collapse
Instance Attribute Details
#violations ⇒ Object
Returns the value of attribute violations
7 8 9 |
# File 'lib/cane/violation_formatter.rb', line 7 def violations @violations end |
Instance Method Details
#to_s ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/cane/violation_formatter.rb', line 8 def to_s return '' if violations.empty? grouped_violations.map do |description, violations| format_group_header(description, violations) + format_violations(violations) end.flatten.join("\n") + "\n\n" end |