class OpenTracing::Instrumentation::Rack::RegexpHostSanitazer

RegexpHostSanitazer sanitaze host

Constants

DEFAULT_REPLACE_MAP

Public Class Methods

new(replace_map: DEFAULT_REPLACE_MAP) click to toggle source
# File lib/opentracing/instrumentation/rack/regexp_host_sanitazer.rb, line 14
def initialize(replace_map: DEFAULT_REPLACE_MAP)
  @replace_map = replace_map
end

Public Instance Methods

sanitaze_host(host) click to toggle source
# 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