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
COLOR_BY_STATUS =
{
  ok: :green,
  warning: :yellow,
  fail: :red
}.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



29
30
31
# File 'lib/database_consistency/writers/simple_writer.rb', line 29

def msg(result)
  "#{result.checker_name} #{status_text(result)} #{key_text(result)} #{result.message}"
end

#writeObject



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

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

    puts msg(result)
  end
end