Module: Geoptima::ErrorCounter

Included in:
Data, Dataset, Event
Defined in:
lib/geoptima/data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



426
427
428
# File 'lib/geoptima/data.rb', line 426

def errors
  @errors
end

Instance Method Details

#combine_errors(other) ⇒ Object



434
435
436
437
438
439
# File 'lib/geoptima/data.rb', line 434

def combine_errors(other)
  puts "Combining errors(#{other.class}:#{other.errors.inspect}) into self(#{self.class}:#{errors.inspect})" if($debug)
  other.errors.keys.each do |name|
    errors[name] = errors[name].to_i + other.errors[name].to_i
  end
end

#incr_error(name) ⇒ Object



430
431
432
433
# File 'lib/geoptima/data.rb', line 430

def incr_error(name)
  errors[name] ||= 0
  errors[name] += 1
end

#report_errors(prefix = nil) ⇒ Object



440
441
442
443
444
445
446
447
# File 'lib/geoptima/data.rb', line 440

def report_errors(prefix=nil)
  if errors && errors.keys.length > 0
    puts "#{prefix}Have #{errors.keys.length} known errors in #{self}:"
    errors.keys.sort.each do |name|
      puts "#{prefix}\t#{name}:\t#{errors[name]}"
    end
  end
end