Sha256: 1c9237636281ba65ca8c6a857f131e72c5dfca9bebbecd51f09f31e11ba25923

Contents?: true

Size: 783 Bytes

Versions: 12

Compression:

Stored size: 783 Bytes

Contents

module DispatchRider
  module Logging

    # Translates a message into a loggable hash based on its result.
    class Translator
      def self.translate(message, kind, **args)
        klass = translator_class(kind)
        fragment = klass.new(message, **args).translate
        { phase: kind }.merge fragment
      end

      def self.translator_class(kind)
        const_get("#{kind}_translator".classify)
      end
    end

  end
end

require_relative 'translator/base_translator'
require_relative 'translator/complete_translator'
require_relative 'translator/fail_translator'
require_relative 'translator/error_handler_fail_translator'
require_relative 'translator/start_translator'
require_relative 'translator/stop_translator'
require_relative 'translator/success_translator'

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dispatch-rider-1.9.0 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.8.6 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.8.5 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.8.4 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.8.3 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.8.2 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.8.1 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.8.0 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.7.2 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.7.1 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.7.0 lib/dispatch-rider/logging/translator.rb
dispatch-rider-1.6.2 lib/dispatch-rider/logging/translator.rb