Sha256: 8b174893c3fafa822bdd033d644d581515f6abc3939e0ba2d3b4988b69b7f4b3
Contents?: true
Size: 1.18 KB
Versions: 5
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true module ConvenientService module Examples module Standard class RequestParams module Services class LogRequestParams include ConvenientService::Standard::Config attr_reader :request, :params, :tag def initialize(request:, params:, tag: Constants::Tags::EMPTY) @request = request @params = params @tag = tag end def result Entities::Logger.log(message) success end private def message <<~MESSAGE #{prefix}: { #{content} } MESSAGE end def prefix text = "[Thread##{Thread.current.object_id}]" text += " [Request##{request.object_id}]" text += " [Params]" text += " [#{tag}]" unless tag.empty? text end def content params.map { |key, value| " #{key}: #{value.inspect}" }.join(",\n") end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems