Class: OpenTracing::Instrumentation::Rack::RegexpPathSanitazer
- Inherits:
-
Object
- Object
- OpenTracing::Instrumentation::Rack::RegexpPathSanitazer
- Defined in:
- lib/opentracing/instrumentation/rack/regexp_path_sanitazer.rb
Overview
RegexpPathSanitazer return raw path
Constant Summary collapse
- DEFAULT_REPLACE_MAP =
{ '/:object_id\1' => %r{/[0-9a-f]{24}(/|$)}, '/:sequence_id\1' => %r{/\d+(/|$)}, '/:phone\1' => %r{/\+\d+(/|$)}, }.freeze
Instance Method Summary collapse
-
#initialize(replace_map: DEFAULT_REPLACE_MAP) ⇒ RegexpPathSanitazer
constructor
A new instance of RegexpPathSanitazer.
- #sanitaze_path(path) ⇒ Object
Constructor Details
#initialize(replace_map: DEFAULT_REPLACE_MAP) ⇒ RegexpPathSanitazer
Returns a new instance of RegexpPathSanitazer.
16 17 18 19 20 |
# File 'lib/opentracing/instrumentation/rack/regexp_path_sanitazer.rb', line 16 def initialize( replace_map: DEFAULT_REPLACE_MAP ) @replace_map = replace_map end |
Instance Method Details
#sanitaze_path(path) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/opentracing/instrumentation/rack/regexp_path_sanitazer.rb', line 22 def sanitaze_path(path) @replace_map.each do |(target, regexp)| path = path.gsub(regexp, target) end path end |