Sha256: 6a8e38664ec55de99fd241994b066d221b5b5c309821a193c9d8de817f82bd80
Contents?: true
Size: 1.12 KB
Versions: 22
Compression:
Stored size: 1.12 KB
Contents
require 'bbk/utils/proxy_logger' module BBK module App module Processors class Base attr_reader :logger def initialize(*untyped, logger: BBK::App.logger, **) logger = logger.respond_to?(:tagged) ? logger : ActiveSupport::TaggedLogging.new(logger) @logger = BBK::Utils::ProxyLogger.new(logger, tags: self.class.to_s) end def rule unless self.class.respond_to?(:rule) raise NotImplementedError.new("Not implemented class method rule in #{self.class.name}") end self.class.rule end def call(message, results: []) debug 'processing message...' process(message, results: results) results end def process(_message, results: []) raise NotImplementedError.new("process method abstract in Processor class. Results count: #{results.count}") end %i[debug info warn error fatal unknown].each do |severity| define_method(severity) do |*args| logger.public_send(severity, *args) end end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
bbk-app-1.0.0.72917 | lib/bbk/app/processors/base.rb |
bbk-app-1.0.0.72899 | lib/bbk/app/processors/base.rb |