Class: OpenTracing::Instrumentation::Rack::RegexpHostSanitazer
- Inherits:
-
Object
- Object
- OpenTracing::Instrumentation::Rack::RegexpHostSanitazer
- Defined in:
- lib/opentracing/instrumentation/rack/regexp_host_sanitazer.rb
Overview
RegexpHostSanitazer sanitaze host
Constant Summary collapse
- DEFAULT_REPLACE_MAP =
{ '\1.0.0.0' => /^(\d+)\.\d+\.\d+\.\d+:\d+$/, }.freeze
Instance Method Summary collapse
-
#initialize(replace_map: DEFAULT_REPLACE_MAP) ⇒ RegexpHostSanitazer
constructor
A new instance of RegexpHostSanitazer.
- #sanitaze_host(host) ⇒ Object
Constructor Details
#initialize(replace_map: DEFAULT_REPLACE_MAP) ⇒ RegexpHostSanitazer
Returns a new instance of RegexpHostSanitazer.
14 15 16 |
# File 'lib/opentracing/instrumentation/rack/regexp_host_sanitazer.rb', line 14 def initialize(replace_map: DEFAULT_REPLACE_MAP) @replace_map = replace_map end |
Instance Method Details
#sanitaze_host(host) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/opentracing/instrumentation/rack/regexp_host_sanitazer.rb', line 18 def sanitaze_host(host) @replace_map.each do |pattern, regexp| host = host.gsub(regexp, pattern) end host end |