Class: SportDb::PathspecReport

Inherits:
Object
  • Object
show all
Defined in:
lib/fbtok/pathspec_report.rb

Overview

PathspecReport (aka/formerly BatchReport)

Instance Method Summary collapse

Constructor Details

#initialize(specs, title:) ⇒ PathspecReport

Returns a new instance of PathspecReport.



7
8
9
10
# File 'lib/fbtok/pathspec_report.rb', line 7

def initialize( specs, title: )
   @specs = specs
   @title = title
end

Instance Method Details

#buildObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fbtok/pathspec_report.rb', line 12

def build
   buf = String.new
   buf << "# #{@title} - #{@specs.size} dataset(s)\n\n"

   @specs.each_with_index do |rec,i|
     datafiles  = rec['datafiles']
     errors     = rec['errors']

     if errors.size > 0
       buf << "!! #{errors.size} ERROR(S)  "
     else
       buf << "   OK          "
     end
     buf << "%-20s" % rec['path']
     buf << " - #{datafiles.size} datafile(s)"
     buf << "\n"

     if errors.size > 0
       buf << errors.pretty_inspect
       buf << "\n"
     end
   end

   buf
end