Class: IMissValidator::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/i_miss_validator/reporter.rb

Defined Under Namespace

Modules: Colorize

Class Method Summary collapse

Class Method Details



36
37
38
39
# File 'lib/i_miss_validator/reporter.rb', line 36

def self.print_with_indent(level, str = "")
  level = 1 if 1 > level
  puts "  " * (level - 1) + str
end

.report(results = []) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/i_miss_validator/reporter.rb', line 20

def self.report(results = [])
  results.each do |result|
    next if result[:problems].keys.size == 0

    print_with_indent(1, "Model".red + ": #{result[:model]}")

    result[:problems].each do |column, problems|
      print_with_indent(2, "Column".pink + ": #{column}")

      problems.each do |problem|
        print_with_indent(3, "Missing".yellow + ": #{problem[:message]}")
      end
    end
  end
end