Sha256: 941fb652cd446d88b7c4bd4442bdc581d45a2b77bb89400678379589aff19f87
Contents?: true
Size: 697 Bytes
Versions: 17
Compression:
Stored size: 697 Bytes
Contents
# frozen_string_literal: true require 'rack' module OpenTracing module Instrumentation module Rack # RegexpPathSanitazer return raw path class RegexpPathSanitazer DEFAULT_REPLACE_MAP = { '/:object_id\1' => %r{/[0-9a-f]{24}(/|$)}, '/:sequence_id\1' => %r{/\d+(/|$)}, '/:phone\1' => %r{/\+\d+(/|$)}, }.freeze def initialize( replace_map: DEFAULT_REPLACE_MAP ) @replace_map = replace_map end def sanitaze_path(path) @replace_map.each do |(target, regexp)| path = path.gsub(regexp, target) end path end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems