Sha256: b7c0ccf589b0b35d8891d2e0e4957dd40379ef53442fb8e1235ee5f418856172
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
module Topographer class Importer module Logger class Base attr_reader :fatal_errors def initialize @fatal_errors = [] end def successes raise NotImplementedError end def failures raise NotImplementedError end def log_import(log_entry) if log_entry.success? log_success(log_entry) else log_failure(log_entry) end end def log_success(log_entry) raise NotImplementedError end def log_failure(log_entry) raise NotImplementedError end def log_fatal(source, message) @fatal_errors << Topographer::Importer::Logger::FatalErrorEntry.new(source, message) end def successful_imports raise NotImplementedError end def failed_imports raise NotImplementedError end def entries? total_imports > 0 end def total_imports (successful_imports + failed_imports) end def all_entries (successes + failures + fatal_errors).sort { |a, b| a.timestamp <=> b.timestamp } end def errors? fatal_error? || failed_imports > 0 end def success? !errors? end def fatal_error? @fatal_errors.any? end def save raise NotImplementedError end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
topographer-0.0.9 | lib/topographer/importer/logger/base.rb |
topographer-0.0.8 | lib/topographer/importer/logger/base.rb |