Class: DatabaseConsistency::Writers::SimpleWriter
- Inherits:
-
BaseWriter
- Object
- BaseWriter
- DatabaseConsistency::Writers::SimpleWriter
- Defined in:
- lib/database_consistency/writers/simple_writer.rb
Overview
The simplest formatter
Instance Attribute Summary
Attributes inherited from BaseWriter
Instance Method Summary collapse
Methods inherited from BaseWriter
#debug?, #initialize, write, #write?
Constructor Details
This class inherits a constructor from DatabaseConsistency::Writers::BaseWriter
Instance Method Details
#format ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/database_consistency/writers/simple_writer.rb', line 12 def format results.map do |result| next unless write?(result[:status]) line(result) end.tap(&:compact!).map(&:lstrip).delete_if(&:empty?).join("\n") end |
#line(result) ⇒ Object
20 21 22 23 24 |
# File 'lib/database_consistency/writers/simple_writer.rb', line 20 def line(result) s = "#{result.status} #{result.table_or_model_name} #{result.column_or_attribute_name} #{result.}" s += " (checker: #{result.checker_name})" if debug? s end |
#write ⇒ Object
8 9 10 |
# File 'lib/database_consistency/writers/simple_writer.rb', line 8 def write puts format end |