# frozen_string_literal: true class Netdisco module NameMap def name_map(origin_name) name = origin_name.dup # 早期异常拦截 if name.nil? Log.debug "Netdisco name_map origin_name is nil" return nil end # 字典替换 CFG.name_map.each do |match, replace| re = Regexp.new match name = name.sub re, replace end name end end end