Class: SportDb::Parser::BatchReport

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

Overview

BatchReport (a.k.a. PathspecsReport)

Instance Method Summary collapse

Constructor Details

#initialize(specs, title:) ⇒ BatchReport

Returns a new instance of BatchReport.



162
163
164
165
# File 'lib/fbtok/opts.rb', line 162

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

Instance Method Details

#buildObject



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/fbtok/opts.rb', line 167

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

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

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

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

   buf
end