Class: DatabaseConsistency::Writers::SimpleWriter

Inherits:
BaseWriter
  • Object
show all
Defined in:
lib/database_consistency/writers/simple_writer.rb

Overview

The simplest formatter

Constant Summary collapse

COLORS =
{
  blue: "\e[34m",
  yellow: "\e[33m",
  green: "\e[32m",
  red: "\e[31m"
}.freeze

Instance Attribute Summary

Attributes inherited from BaseWriter

#config, #results

Instance Method Summary collapse

Methods inherited from BaseWriter

#initialize, write, #write?

Constructor Details

This class inherits a constructor from DatabaseConsistency::Writers::BaseWriter

Instance Method Details

#msg(result) ⇒ Object



23
24
25
26
27
# File 'lib/database_consistency/writers/simple_writer.rb', line 23

def msg(result)
  msg = "#{status_text(result)} #{key_text(result)} #{result.message}"
  msg += " (checker: #{result.checker_name})" if config.debug?
  msg
end

#writeObject



15
16
17
18
19
20
21
# File 'lib/database_consistency/writers/simple_writer.rb', line 15

def write
  results.each do |result|
    next unless write?(result.status)

    puts msg(result)
  end
end