Sha256: f018d891be851a9b356eb29e5e34edf39e0c6b90e2320b97b2797a1188b6cf0f

Contents?: true

Size: 812 Bytes

Versions: 1

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

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

1 entries across 1 versions & 1 rubygems

Version Path
dispatch-rider-2.2.0 lib/dispatch-rider/logging/translator.rb