Class: SportDb::PathspecReport

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

Overview

PathspecReport (aka/formerly BatchReport)

Instance Method Summary collapse

Constructor Details

#initialize(specs, title:) ⇒ PathspecReport

Returns a new instance of PathspecReport.



153
154
155
156
# File 'lib/fbtok/pathspec.rb', line 153

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

Instance Method Details

#buildObject



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/fbtok/pathspec.rb', line 158

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