Sha256: 6b01e8bce8901474ff88ec2f77f92a55515083e0b04a0f1a06a2e874f4dacd02

Contents?: true

Size: 427 Bytes

Versions: 1

Compression:

Stored size: 427 Bytes

Contents

# 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
netdisco-0.0.8 lib/netdisco/name_map.rb