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.



177
178
179
180
# File 'lib/fbtok/pathspec.rb', line 177

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

Instance Method Details

#buildObject



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/fbtok/pathspec.rb', line 182

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