Class: RCheck::ReportPrinters::Tree

Inherits:
Abstract
  • Object
show all
Defined in:
lib/rcheck/report_printers.rb

Instance Method Summary collapse

Methods inherited from Abstract

#initialize

Methods included from Colors::Mixin

#cprint, #cputs, #with_color

Constructor Details

This class inherits a constructor from RCheck::ReportPrinters::Abstract

Instance Method Details

#offset(indent) ⇒ Object



99
100
101
# File 'lib/rcheck/report_printers.rb', line 99

def offset(indent)
  print ' ' * indent
end

#report(suite, indent = 0) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/rcheck/report_printers.rb', line 67

def report(suite, indent=0)
  continues = suite.total(*@opts[:show]).any? || suite.parent.nil?

  offset indent
  unless suite.name.nil?
    cprint suite.severity(:total), suite.name

    if suite.total(:all).any?
      cprint :quiet, ' ('
      first = true
      suite.counts(:total).each do |status, count|
        if count > 0
          cprint status, first ? '' : ' ', count
          first = false
        end
      end
      if suite.children.any? and !continues
        print ' ' unless first
        cprint :quiet, '+'
      end
      cprint :quiet, ')'
    end
    puts
  end

  if continues
    suite.children.each do |child|
      report child, indent + 2
    end
  end
end